public void add(XYPoint[] point) //向网格中增加雷达数据 { long x, y, key; Sum_Point sum; for (int i = 0; i < point.Length; i++) { x = (long)point[i].x / distance; y = (long)point[i].y / distance; key = x * tolindex + y; if (!sumKey.ContainsKey(key)) { sum = new Sum_Point(); sum.set(point[i]); pointGrid.Add(key, sum); sumKey.Add(key, key); keyStack.Push(key); } else { sum = pointGrid[key]; sum.add(point[i]); pointGrid[key] = sum; } } }
void sumPoint() //计算点的平均值 { long key; Sum_Point xp, yp; foreach (long k in pointGrid.Keys) { yp = pointGrid[k]; key = sumKey[k]; if (nowlist.ContainsKey(key)) { xp = nowlist[key]; xp.add(yp); nowlist[key] = xp; } else { xp = new Sum_Point(); xp.set(yp); nowlist.Add(key, xp); } } }