Exemple #1
0
        private void createDictionaryArray()
        {
            IEnvelope env1 = referenceRaster.RasterInfo.Extent;
            IEnvelope env2 = transformRaster.RasterInfo.Extent;

            env1.Intersect(env2);
            clipGeo = (IGeometry)env1;
            IFunctionRasterDataset minRs = rsUtil.calcArithmaticFunction(referenceRaster, transformRaster, esriRasterArithmeticOperation.esriRasterMinus);

            clipRs = rsUtil.clipRasterFunction(minRs, clipGeo, esriRasterClippingType.esriRasterClippingOutside);
            IPnt pntSize = new PntClass();

            pntSize.SetCoords(512, 512);
            IRasterCursor rsCur = ((IRaster2)rsUtil.createRaster(clipRs)).CreateCursorEx(pntSize);
            int           pCnt  = rsCur.PixelBlock.Planes;

            do
            {
                IPixelBlock pbMinBlock = rsCur.PixelBlock;
                for (int r = 0; r < pbMinBlock.Height; r++)
                {
                    for (int c = 0; c < pbMinBlock.Width; c++)
                    {
                        for (int p = 0; p < pCnt; p++)
                        {
                            object vlObj = pbMinBlock.GetVal(p, c, r);
                            if (vlObj == null)
                            {
                                continue;
                            }
                            else
                            {
                                int vl = System.Convert.ToInt32(vlObj);
                                Dictionary <int, int> cDic = difDic[p];
                                int cnt = 0;
                                if (!cDic.TryGetValue(vl, out cnt))
                                {
                                    cDic.Add(vl, 1);
                                }
                                else
                                {
                                    cDic[vl] = cnt + 1;
                                }
                                cellCount[p] += 1;
                            }
                        }
                    }
                }
            } while (rsCur.Next() == true);
        }
Exemple #2
0
        public bool checkExtents()
        {
            IEnvelope           zenv = zRs.RasterInfo.Extent;
            IEnvelope           venv = vRs.RasterInfo.Extent;
            IRelationalOperator rsOp = (IRelationalOperator)zenv;

            if (rsOp.Disjoint(venv))
            {
                return(false);
            }
            else
            {
                if (!rsOp.Equals(venv))
                {
                    zenv.Intersect(venv);
                }
                intEnv = zenv;
                return(true);
            }
        }