当前位置: 首页>>代码示例>>C#>>正文


C# ESRI.GetVal方法代码示例

本文整理汇总了C#中ESRI.GetVal方法的典型用法代码示例。如果您正苦于以下问题:C# ESRI.GetVal方法的具体用法?C# ESRI.GetVal怎么用?C# ESRI.GetVal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ESRI的用法示例。


在下文中一共展示了ESRI.GetVal方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: getTransformedValue

        public override object getTransformedValue(ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 bigArr, int startClm, int startRw, int nBand)
        {
            //Console.WriteLine("Start CR = " + startClm.ToString()+":"+ startRw.ToString());
            float s = 0;
            float s2 = 0;
            foreach (int[] xy in offsetLst)
            {
                int bWc = xy[0] + startClm;
                int bRc = xy[1] + startRw;

                object vlObj = bigArr.GetVal(nBand, bWc, bRc);

                if (vlObj == null)
                {
                    continue;
                }
                else
                {
                    float vl = (float)vlObj;
                    s += vl;
                    s2 += vl * vl;
                }
            }
            return (s2 - ((s * s) / offsetLst.Count)) / offsetLst.Count;
        }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:25,代码来源:focalSampleHelperVariance.cs

示例2: setPixelData

        private void setPixelData(int p, ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 pbIn, ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 pbInBig)
        {
            System.Array pbArr = (System.Array)pbIn.get_PixelData(p);
            for (int r = 0; r < pbIn.Height; r++)
            {
                for (int c = 0; c < pbIn.Width; c++)
                {
                    HashSet<float> hash = new HashSet<float>();
                    for (int rb = 0; rb < rws; rb++)
                    {
                        int nrb = r + rb;
                        for (int cb = 0; cb < clms; cb++)
                        {
                            int ncb = c + cb;
                            object objVl = pbInBig.GetVal(p, ncb, nrb);
                            if (objVl != null)
                            {
                                float vl = System.Convert.ToSingle(objVl);
                                hash.Add(vl);
                            }
                        }
                    }

                    pbArr.SetValue(hash.Count, c, r);
                }

            }
            pbIn.set_PixelData(p, pbArr);
        }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:29,代码来源:focalHelperUnique.cs

示例3: setPixelData

        private void setPixelData(int p, ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 pbIn, ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 pbInBig)
        {
            System.Array pbArr = (System.Array)pbIn.get_PixelData(p);
            for (int r = 0; r < pbIn.Height; r++)
            {
                for (int c = 0; c < pbIn.Width; c++)
                {
                    int tCnt = 0;
                    Dictionary<float, int> vlDic = new Dictionary<float, int>();
                    for (int rb = 0; rb < rws; rb++)
                    {
                        int nrb = r + rb;
                        for (int cb = 0; cb < clms; cb++)
                        {
                            int ncb = c + cb;
                            object objVl = pbInBig.GetVal(p, ncb, nrb);
                            if (objVl != null)
                            {
                                float vl = System.Convert.ToSingle(objVl);
                                int vlCnt = 1;
                                //Console.WriteLine("From Thread " + p.ToString() + "; " + vl.ToString());
                                if (vlDic.TryGetValue(vl, out vlCnt))
                                {
                                    vlDic[vl] = vlCnt + 1;
                                }
                                else
                                {
                                    vlDic.Add(vl, 1);
                                }
                                tCnt += 1;

                            }
                        }
                    }
                    int rSum = 0;
                    int halfCnt = tCnt/2;
                    List<float> keyLst = vlDic.Keys.ToList();
                    keyLst.Sort();
                    foreach (float f in keyLst)
                    {
                        int vlCnt = vlDic[f];
                        rSum = rSum+vlCnt;
                        if (rSum > halfCnt)
                        {
                            pbArr.SetValue(f, c, r);
                            break;
                        }
                    }
                    //pbArr.SetValue(ent, c, r);
                }

            }
            pbIn.set_PixelData(p, pbArr);
        }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:54,代码来源:focalHelperMedian.cs

示例4: setPixelData

        private void setPixelData(int p, ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 pbIn, ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 pbInBig)
        {
            System.Array pbArr = (System.Array)pbIn.get_PixelData(p);
            for (int r = 0; r < pbIn.Height; r++)
            {
                for (int c = 0; c < pbIn.Width; c++)
                {
                    Dictionary<float, int> vlDic = new Dictionary<float, int>();
                    for (int rb = 0; rb < rws; rb++)
                    {
                        int nrb = r + rb;
                        for (int cb = 0; cb < clms; cb++)
                        {
                            int ncb = c + cb;
                            object objVl = pbInBig.GetVal(p, ncb, nrb);
                            if (objVl != null)
                            {
                                float vl = System.Convert.ToSingle(objVl);
                                int vlCnt = 1;
                                //Console.WriteLine("From Thread " + p.ToString() + "; " + vl.ToString());
                                if (vlDic.TryGetValue(vl, out vlCnt))
                                {
                                    vlDic[vl] = vlCnt + 1;
                                }
                                else
                                {
                                    vlDic.Add(vl, 1);
                                }

                            }
                        }
                    }
                    int maxCnt = 0;
                    float maxVl = 0;
                    foreach (KeyValuePair<float, int> kvp in vlDic)
                    {
                        int kVl = kvp.Value;
                        //Console.WriteLine("kVl = " + kVl.ToString());
                        if (kVl > maxCnt)
                        {
                            maxVl = kvp.Key;
                            maxCnt = kVl;
                        }
                    }
                    pbArr.SetValue(maxVl, c, r);
                }

            }
            pbIn.set_PixelData(p, pbArr);
        }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:50,代码来源:focalHelperMode.cs

示例5: setPixelData

        private void setPixelData(int p, ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 pbIn, ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 pbInBig)
        {
            System.Array pbArr = (System.Array)pbIn.get_PixelData(p);
            for (int r = 0; r < pbIn.Height; r++)
            {
                for (int c = 0; c < pbIn.Width; c++)
                {
                    float tCnt = 0;
                    Dictionary<float, int> vlDic = new Dictionary<float, int>();
                    for (int rb = 0; rb < rws; rb++)
                    {
                        int nrb = r + rb;
                        for (int cb = 0; cb < clms; cb++)
                        {
                            int ncb = c + cb;
                            object objVl = pbInBig.GetVal(p, ncb, nrb);
                            if (objVl != null)
                            {
                                float vl = System.Convert.ToSingle(objVl);
                                int vlCnt = 1;
                                //Console.WriteLine("From Thread " + p.ToString() + "; " + vl.ToString());
                                if (vlDic.TryGetValue(vl, out vlCnt))
                                {
                                    vlDic[vl] = vlCnt + 1;
                                }
                                else
                                {
                                    vlDic.Add(vl, 1);
                                }
                                tCnt += 1;

                            }
                        }
                    }
                    float prob = 0;
                    float ent = 0;
                    foreach (int vlCnt in vlDic.Values)
                    {
                        prob = vlCnt / tCnt;
                        ent = ent+(prob * prob);
                    }
                    pbArr.SetValue(ent, c, r);
                }

            }
            pbIn.set_PixelData(p, pbArr);
        }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:47,代码来源:focalHelperProbability.cs

示例6: getTransformedValue

        public override object getTransformedValue(ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 bigArr, int startClm, int startRw, int nBand)
        {
            Dictionary<float, int> countDic = new Dictionary<float, int>();
            foreach (int[] xy in offsetLst)
            {
                int bWc = xy[0] + startClm;
                int bRc = xy[1] + startRw;
                object vlObj = bigArr.GetVal(nBand, bWc, bRc);

                if (vlObj == null)
                {
                    continue;
                }
                else
                {
                    //int vl2 = System.Convert.ToInt32(vl);
                    //Console.WriteLine(vl)
                    float vl = (float)vlObj;
                    int cnt = 0;
                    if (countDic.TryGetValue(vl, out cnt))
                    {
                        countDic[vl] = cnt + 1;
                    }
                    else
                    {
                        countDic.Add(vl, 1);
                    }
                }
            }
            int vlMax = countDic.Values.Max();
            float key = noDataValue;
            foreach (KeyValuePair<float, int> kVp in countDic)
            {
                float k = kVp.Key;
                int v = kVp.Value;
                if (v == vlMax)
                {
                    key = k;
                    break;
                }
            }
            //Console.WriteLine(vlMax);
            return key;
        }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:44,代码来源:focalSampleHelperMode.cs

示例7: getTransformedValue

        public override object getTransformedValue(ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 bigArr, int startClm, int startRw, int nBand)
        {
            HashSet<float> unq = new HashSet<float>();
            foreach (int[] xy in offsetLst)
            {
                int bWc = xy[0] + startClm;
                int bRc = xy[1] + startRw;
                object vlObj = bigArr.GetVal(nBand, bWc, bRc);

                if (vlObj == null)
                {
                    continue;
                }
                else
                {
                    float vl = (float)vlObj;
                    unq.Add(vl);
                }
            }
            return unq.Count;
        }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:21,代码来源:focalSampleHelperUnique.cs

示例8: getTransformedValue

        public override object getTransformedValue(ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 bigArr, int startClm, int startRw, int nBand)
        {
            Dictionary<float, int> countDic = new Dictionary<float, int>();
            int cntSub = 0;
            foreach (int[] xy in offsetLst)
            {
                int bWc = xy[0] + startClm;
                int bRc = xy[1] + startRw;
                object vlObj = bigArr.GetVal(nBand, bWc, bRc);

                if (vlObj == null)
                {
                    cntSub+=1;
                }
                else
                {
                    float vl = (float)vlObj;
                    int cnt = 0;
                    if (countDic.TryGetValue(vl, out cnt))
                    {
                        countDic[vl] = cnt+1;
                    }
                    else
                    {
                        countDic.Add(vl, 1);
                    }
                }
            }
            int n = offsetLst.Count - cntSub;
            float prob = 0;
            float ent = 0;
            foreach (int v in countDic.Values)
            {
                prob = (System.Convert.ToSingle(v) / n);
                ent += (prob * System.Convert.ToSingle(Math.Log(prob)));
            }
            //Console.WriteLine(vlMax);
            return (ent * -1);
        }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:39,代码来源:focalSampleHelperEntropy.cs

示例9: getTransformedValue

        public override object getTransformedValue( ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 bigArr, int startClm, int startRw, int nBand)
        {
            //Console.WriteLine("Start CR = " + startClm.ToString()+":"+ startRw.ToString());
            float db = 0;
            foreach (int[] xy in offsetLst)
            {
                int bWc = xy[0] + startClm;
                int bRc = xy[1] + startRw;
                object objVl = bigArr.GetVal(nBand,bWc, bRc);

                //Console.WriteLine("\t"+vl.ToString());
                if (objVl==null)
                {
                    continue;
                }
                else
                {
                    db += (float)objVl;
                }
            }
            return db/offsetLst.Count;
        }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:22,代码来源:focalSampleHelperMean.cs

示例10: getTransformedValue

        public override object getTransformedValue(ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 bigArr, int startClm, int startRw, int nBand)
        {
            List<float> dbLst = new List<float>();
            foreach (int[] xy in offsetLst)
            {
                int bWc = xy[0] + startClm;
                int bRc = xy[1] + startRw;
                object vlObj = bigArr.GetVal(nBand, bWc, bRc);

                if (vlObj == null)
                {
                    continue;
                }
                else
                {
                    float vl = (float)vlObj;
                    dbLst.Add(vl);
                }
            }
            int middleVlIndex = dbLst.Count / 2;
            dbLst.Sort();
            return dbLst[middleVlIndex];
        }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:23,代码来源:focalSampleHelperMedian.cs

示例11: getTransformedValue

 public override object getTransformedValue(ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 bigArr, int startClm, int startRw, int nBand)
 {
     float db = Single.MinValue;
     foreach (int[] xy in offsetLst)
     {
         int bWc = xy[0] + startClm;
         int bRc = xy[1] + startRw;
         object objVl = bigArr.GetVal(nBand, bWc, bRc);
         if (objVl==null)
         {
             continue;
         }
         else
         {
             float vl = (float)objVl;
             if (vl > db)
             {
                 db = vl;
             }
         }
     }
     return db;
 }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:23,代码来源:focalSampleHelperMax.cs

示例12: setPixelDataFolding

        private void setPixelDataFolding(int p, ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 pbIn, ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 pbInBig)
        {
            System.Array pbArr = (System.Array)pbIn.get_PixelData(p);
            Dictionary<float, int>[][] wrDic1 = new Dictionary<float, int>[pbIn.Width][];
            //create first dictionary and set first values
            for (int w = 0; w < pbIn.Width; w++)
            {
                wrDic1[w] = new Dictionary<float, int>[rws];
                for (int r = 0; r < rws; r++)
                {
                    wrDic1[w][r] = new Dictionary<float, int>();
                    Dictionary<float, int> fDic = wrDic1[w][r];
                    for (int c = 0; c < clms; c++)
                    {
                        object objVl = pbInBig.GetVal(p, c, r);
                        if (objVl != null)
                        {
                            float vl = System.Convert.ToSingle(objVl);
                            int vlCnt;
                            if (fDic.TryGetValue(vl, out vlCnt))
                            {
                                fDic[vl] = vlCnt + 1;
                            }
                            else
                            {
                                fDic.Add(vl, 1);
                            }
                        }
                    }
                }
                setValues(pbArr, wrDic1[w], w, 0);
            }
            //create next dictionary and set the rest of the values
            int clmsM = clms - 1;
            int rwsM = rws - 1;
            Dictionary<float, int>[][] wrDic2 = new Dictionary<float, int>[pbIn.Width][];
            //wrDic2[0][0] = wrDic1[0][rwsM];
            for (int r = 1; r < pbIn.Height; r++)
            {
                for (int c = 0; c < pbIn.Width; c++)
                {
                    Dictionary<float, int> clmsDic;
                    wrDic2[c] = new Dictionary<float, int>[rws];
                    for (int rb = 1; rb < rws; rb++)
                    {
                        wrDic2[c][rb - 1] = new Dictionary<float, int>(wrDic1[c][rb]);
                    }
                    int nrb = r + rwsM;
                    if (c > 0)// copy previous dictionary on same row and remove/add values
                    {
                        wrDic2[c][rwsM] = new Dictionary<float, int>(wrDic2[c - 1][rwsM]);
                        clmsDic = wrDic2[c][rwsM];
                        int ncb = c + clmsM;
                        object objVln = pbInBig.GetVal(p, ncb, nrb);
                        object objVlo = pbInBig.GetVal(p, c - 1, nrb);
                        if (objVlo != null)//remove old value
                        {
                            float vlo = System.Convert.ToSingle(objVlo);
                            int vloCnt = clmsDic[vlo];
                            if (vloCnt > 1)
                            {
                                clmsDic[vlo] = vloCnt - 1;
                            }
                            else
                            {
                                clmsDic.Remove(vlo);
                            }
                        }
                        if (objVln != null)//add new value
                        {
                            float vln = System.Convert.ToSingle(objVln);
                            int vlnCnt;
                            if (clmsDic.TryGetValue(vln, out vlnCnt))
                            {
                                clmsDic[vln] = vlnCnt + 1;
                            }
                            else
                            {
                                clmsDic.Add(vln, 1);
                            }

                        }
                    }
                    else //first column, need to get all numbers of new row
                    {
                        wrDic2[c][rwsM] = new Dictionary<float, int>();
                        Dictionary<float, int> fDic = wrDic2[c][rwsM];
                        for (int c2 = 0; c2 < clms; c2++)
                        {
                            object objVl = pbInBig.GetVal(p, c2, nrb);
                            if (objVl != null)
                            {
                                float vl = System.Convert.ToSingle(objVl);
                                int vlCnt;
                                if (fDic.TryGetValue(vl, out vlCnt))
                                {
                                    fDic[vl] = vlCnt + 1;
                                }
                                else
                                {
//.........这里部分代码省略.........
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:101,代码来源:focalHelperMedian.cs

示例13: updatePixelRectangle

        public override void updatePixelRectangle(ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 pbIn, ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 pbInBig)
        {
            int rs = pbInBig.Height;
            int cs = pbInBig.Width;
            int hc = clms - 1;
            int hr = rws - 1;
            int scs = pbIn.Width;
            int srs = pbIn.Height;
            Queue<float[]>[] windowQueue = new Queue<float[]>[pbIn.Planes];
            for (int b = 0; b < pbIn.Planes; b++)
            {
                System.Array upArr = (System.Array)pbIn.get_PixelData(b); ;
                Queue<float[]> queB = new Queue<float[]>();
                windowQueue[b] = queB;
                for (int r = 0; r < rws; r++)
                {
                    int nr = r - hr;
                    float[] sumNewBigArr = new float[scs];

                    float sumVl = 0;
                    for (int c = 0; c < clms; c++)
                    {

                        object objBvl = pbInBig.GetVal(b, c, r);
                        float bVl = 0;
                        if (objBvl != null)
                        {
                            bVl = (float)objBvl;
                        }
                        sumVl += bVl;
                    }
                    sumNewBigArr[0] = sumVl;
                    for (int c = clms; c < cs; c++)
                    {
                        int nc = c - hc;
                        int pc = c - clms;
                        object bVlobj = pbInBig.GetVal(b, c, r);
                        object pVlobj = pbInBig.GetVal(b, pc, r);
                        float bVl = 0;
                        float pVl = 0;
                        if (bVlobj!=null)
                        {
                            bVl = (float)bVlobj;
                        }
                        if (pVlobj!=null)
                        {
                            pVl = (float)pVlobj;
                        }
                        sumVl += bVl - pVl;
                        try
                        {
                            sumNewBigArr[nc] = sumVl;
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e.ToString());
                            System.Windows.Forms.MessageBox.Show(e.ToString());

                        }
                    }
                    queB.Enqueue(sumNewBigArr);
                }
                updateFirstRow(queB, ref upArr, ref pbIn);
                for (int r = rws; r < rs; r++)
                {
                    int pr = r-rws;
                    int nr = r - hr;
                    float[] sumNewBigArr = new float[scs];
                    float sumVl = 0;
                    //first 3 values
                    for (int c = 0; c < clms; c++)
                    {
                        object bVlobj = pbInBig.GetVal(b, c, r);
                        float bVl = 0;
                        if (bVlobj!=null)
                        {
                            bVl = (float)bVlobj;
                        }
                        sumVl += bVl;
                    }
                    sumNewBigArr[0] = sumVl;
                    float oldSumVl = queB.Peek()[0];
                    float pSmallArrValue = (float)upArr.GetValue(0,pr);//pSmallArrValues[0];
                    float nSmallArrValue = pSmallArrValue + sumVl - oldSumVl;
                    upArr.SetValue(nSmallArrValue, 0, nr);
                    //pSmallArrValues[0] = nSmallArrValue;
                    for (int c = clms; c < cs; c++)
                    {
                        int nc = c - hc;
                        int pc = c - clms;
                        object bVlobj = pbInBig.GetVal(b, c, r);
                        object pVlobj = pbInBig.GetVal(b, pc, r);
                        float bVl = 0;
                        float pVl = 0;
                        if (bVlobj!=null)
                        {
                            bVl = (float)bVlobj;
                        }
                        if (pVlobj!=null)
                        {
//.........这里部分代码省略.........
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:101,代码来源:focalHelperMean.cs


注:本文中的ESRI.GetVal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。