private IFunctionRasterDataset calcCorr() { //Cov double N = (SumRws * SumClms * 2); IFunctionRasterDataset mvRst = getShiftedRaster(InRaster); IFunctionRasterDataset pRs = rsUtil.calcArithmaticFunction(InRaster, mvRst, esriRasterArithmeticOperation.esriRasterPlus); IFunctionRasterDataset pRs2T = rsUtil.calcArithmaticFunction(InRaster, mvRst, esriRasterArithmeticOperation.esriRasterMultiply); IFunctionRasterDataset pRs2 = rsUtil.calcArithmaticFunction(pRs2T, 2, esriRasterArithmeticOperation.esriRasterMultiply); IFunctionRasterDataset mRsT = rsUtil.calcFocalStatisticsFunction(pRs, SumClms, SumRws, rasterUtil.focalType.SUM); IFunctionRasterDataset mRsT2 = rsUtil.calcArithmaticFunction(mRsT, 2, esriRasterArithmeticOperation.esriRasterPower); IFunctionRasterDataset mRs = rsUtil.calcArithmaticFunction(mRsT2, N, esriRasterArithmeticOperation.esriRasterDivide); IFunctionRasterDataset mRs2 = rsUtil.calcFocalStatisticsFunction(pRs2, SumClms, SumRws, rasterUtil.focalType.SUM); IFunctionRasterDataset cov = rsUtil.calcArithmaticFunction(mRs2, mRs, esriRasterArithmeticOperation.esriRasterMinus); //IRaster cov2 = RasterUtility.calcEqualFunction(cov1, 0); //IRaster cov = RasterUtility.calcArithmaticFunction(cov2, cov1, esriRasterArithmeticOperation.esriRasterPlus); //Var IFunctionRasterDataset x2 = rsUtil.calcArithmaticFunction(InRaster, 2, esriRasterArithmeticOperation.esriRasterPower); IFunctionRasterDataset mvRst2 = getShiftedRaster(x2); pRs2 = rsUtil.calcArithmaticFunction(x2, mvRst2, esriRasterArithmeticOperation.esriRasterPlus); mRs2 = rsUtil.calcFocalStatisticsFunction(pRs2, SumClms, SumRws, rasterUtil.focalType.SUM); IFunctionRasterDataset var = rsUtil.calcArithmaticFunction(mRs2, mRs, esriRasterArithmeticOperation.esriRasterMinus); //IRaster var2 = RasterUtility.calcEqualFunction(var1, 0); //IRaster var = RasterUtility.calcArithmaticFunction(var2, var1, esriRasterArithmeticOperation.esriRasterPlus); IFunctionRasterDataset cor = rsUtil.calcArithmaticFunction(cov, var, esriRasterArithmeticOperation.esriRasterDivide); return(RasterUtility.setnullToValueFunction(cor, 1)); }
private void btnOK_Click(object sender, EventArgs e) { if (this.txtRasterDatastName.Text.Trim().Length == 0) { MessageBox.Show("新建栅格数据集名字不能为空!"); } else { IRasterWorkspaceEx ex = this.igxObject_0.InternalObjectName.Open() as IRasterWorkspaceEx; try { if ( RasterUtility.CreateSDERasterDs(ex, this.txtRasterDatastName.Text, int.Parse(this.txtRasterBand.Text), (rstPixelType)this.cboPixelType.SelectedIndex, this.ispatialReference_0, null, null, "") != null) { base.DialogResult = DialogResult.OK; } } catch (COMException exception) { int errorCode = exception.ErrorCode; MessageBox.Show(exception.Message); } } }
private IFunctionRasterDataset makeDefaultGLCMFuntionRaster() { if (WindowType == rasterUtil.windowType.RECTANGLE) { return(RasterUtility.calcGLCMFunction(InRaster, Columns, Rows, Horizontal, GlCM_Metric)); } else { return(RasterUtility.calcGLCMFunction(InRaster, Radius, Horizontal, GlCM_Metric)); } }
public void fillDictionary() { FeatureDictionary = new Dictionary <string, IFeatureClass>(); TableDictionary = new Dictionary <string, ITable>(); FunctionRasterDictionary = new Dictionary <string, IFunctionRasterDataset>(); if (TheMap != null) { for (int i = 0; i < TheMap.LayerCount; i++) { try { ILayer lyr = TheMap.Layer[i]; if (lyr is FeatureLayer) { IFeatureLayer ftrLyr = (IFeatureLayer)lyr; FeatureDictionary[lyr.Name] = ftrLyr.FeatureClass; } else if (lyr is RasterLayer) { IRasterLayer rsLyr = (IRasterLayer)lyr; FunctionRasterDictionary[lyr.Name] = RasterUtility.createIdentityRaster(((IRaster2)rsLyr.Raster).RasterDataset); } else if (lyr is MosaicLayer) { IMosaicLayer msLyr = (IMosaicLayer)lyr; IFeatureLayer ftrLyr = msLyr.BoundaryLayer; FeatureDictionary[ftrLyr.Name] = ftrLyr.FeatureClass; ftrLyr = msLyr.FootprintLayer; FeatureDictionary[ftrLyr.Name] = ftrLyr.FeatureClass; FunctionRasterDictionary[lyr.Name] = (IFunctionRasterDataset)msLyr.MosaicDataset; } } catch { } } IStandaloneTableCollection tblCol = (IStandaloneTableCollection)TheMap; for (int i = 0; i < tblCol.StandaloneTableCount; i++) { try { IStandaloneTable StTbl = tblCol.StandaloneTable[i]; TableDictionary[StTbl.Name] = StTbl.Table; } catch { } } } }
private void btnOK_Click(object sender, EventArgs e) { if (this.txtRasterDatastName.Text.Trim().Length == 0) { MessageBox.Show("新建栅格目录名字不能为空!"); } else { IRasterWorkspaceEx ex = this.igxObject_0.InternalObjectName.Open() as IRasterWorkspaceEx; if ( RasterUtility.createCatalog(ex, this.txtRasterDatastName.Text, "Raster", "Shape", this.ispatialReference_0, this.ispatialReference_1, this.cboPixelType.SelectedIndex == 0, null, this.cboConfigKey.Text) != null) { base.DialogResult = DialogResult.OK; base.Close(); } } }