/// <summary> /// 添加散射体 /// </summary> /// <param name="scatter"></param> public void AddScatter(Scatter scatter) { if (scatter.BorderRect.Top < 0 || scatter.BorderRect.Bottom > this.Size.Height - 1 || scatter.BorderRect.Left < 0 || scatter.BorderRect.Right > this.Size.Width - 1) throw new Exception("添加散射体失败:散射体的一部分在地图范围外!"); foreach (Transmitter tr in this.transmitters.Values) if (scatter.IsPointInside(tr.Location)) throw new Exception("添加散射体失败:现有发射机位于该散射体内部!"); foreach (Receiver re in this.receivers.Values) if (scatter.IsPointInside(re.Location)) throw new Exception("添加散射体失败:现有接收机位于该散射体内部!"); foreach (Scatter s in this.scatters.Values) { if (s.JudgeIntersection(scatter)) throw new Exception("添加散射体失败:与现有散射体重叠!"); if (s.Name == scatter.Name) throw new Exception("添加散射体失败:名称与现有散射体相同!"); } this.scatters[scatter.Name] = scatter; }