public void AddRelayNode(List<double> xList,List<double> yList) { if (AlloteAddRelayNodeEvent != null) { AlloteAddRelayNodeEventArgs e = new AlloteAddRelayNodeEventArgs(xList, yList); AlloteAddRelayNodeEvent(e); } }
private void GetRelayNodeList(AlloteAddRelayNodeEventArgs args, List<RelayNode> rnList) { List<string> candidateSiteName = new List<string>(); List<short> candidateSiteID = new List<short>(); List<RelayCell> commitCarrierList = new List<RelayCell>(); foreach (RelayNode rn in m_RNCollection.RNList) { candidateSiteName.Add(rn.Name); } List<double> listX = args.XList; List<double> listY = args.YList; for (int i = 0; i < listX.Count; i++) { double num4; double num5; LTECell parentCell; if (m_Model.LTECellColl.CellList == null || m_Model.LTECellColl.CellList.Count == 0) { return ; } else { List<LTECell> nearestLTECellList = new List<LTECell>(); float distance = float.MaxValue; LTECell nearestLTECell = new LTECell(); foreach (LTECell cell in m_Model.LTECellColl.CellList) { double dic = Math.Pow((cell.Parent.X - listX[i]), 2) + Math.Pow((cell.Parent.Y - listY[i]), 2); if (dic < distance) { distance = (float)dic; nearestLTECell = cell; } } foreach (LTECell cell in m_Model.LTECellColl.CellList) { double dic = Math.Pow((cell.Parent.X - listX[i]), 2) + Math.Pow((cell.Parent.Y - listY[i]), 2); if (Math.Abs(dic - distance) / distance < 0.0001) { nearestLTECellList.Add(cell); } } List<double> angleList = new List<double>(); foreach (LTECell cell in nearestLTECellList) { double rc_Angle = CalcAngle(listX[i] - cell.Parent.X, listY[i] - cell.Parent.Y); double intersectionAngle = Math.Abs(rc_Angle - cell.Parent.AntConfiguration[0].Azimuth); if (intersectionAngle > 180) { intersectionAngle = 360 - intersectionAngle; } angleList.Add(intersectionAngle); } LTECell[] cellArray = new LTECell[angleList.Count]; double[] angleArray = new double[angleList.Count]; for (int j = 0; j < angleList.Count; j++) { cellArray[j] = nearestLTECellList[j]; angleArray[j] = angleList[j]; } Array.Sort(angleArray, cellArray); parentCell = cellArray[0]; } RelayNode rn = new RelayNode(); rn.X = listX[i]; rn.Y = listY[i]; this.m_GeoObserver.TransformXYToBL(listX[i], listY[i], out num4, out num5); rn.Latitude = num4; rn.Longitude = num5; rn.Altitude = this.m_GeoObserver.GetDTM(rn.X, rn.Y);//获得海拔高度 rn.Name = this.GetNewRelayNodeName(candidateSiteName); rn.Active = true; rn.Visible = true; rn.Equipment = this.m_BTSCol.BtsEquipmentList[0]; rn.Parent = parentCell; rn.ID = this.GetNewRelayNodeID(candidateSiteID); parentCell.RNList.Add(rn); candidateSiteName.Add(rn.Name); candidateSiteID.Add(rn.ID); rnList.Add(rn); RelayCell rc = new RelayCell(rn); rc.Name = this.m_RCCollection.GetValidCellName(rn.Name); commitCarrierList.Add(rc); this.m_RCCollection.AddRelayCell("GIS", commitCarrierList, rn); rc.Reception = this.m_ReceptionEquip[0]; rc.CellToUEAnt.OutdoorAntenna = m_Antenna.FindAntennaByName(m_tplRelayCol.TplRC.AntennaName); rc.RCToCellAnt.OutdoorAntenna = m_Antenna.FindAntennaByName(m_tplRelayCol.TplRN.AntennaName); PropModelConfig item = new PropModelConfig(); item.CalcRadius = (int)(m_tplRelayCol.TplRC.MainCalcRidius); item.CalcResolution = (int)(m_tplRelayCol.TplRC.MainModelResolution); item.PropModelID = m_tplRelayCol.TplRC.MainPropagModelID; rc.FreqBand = rc.ParentRN.Parent.FreqBand; rc.ChannelIndex = rc.FreqBand.AvailableChIndexList[0]; rc.PropModels.Clear(); rc.PropModels.Add(item); rc.RelayUEPropModelConfig = rc.PropModels[0]; commitCarrierList.Clear(); } }
//private void AllotingAddEvent(EventArgs args, List<RelayNode> rnList) //{ // m_model.RNColl.AddRelayNode("AllotingRN", rnList); //} private void AllotingAddEvent(AlloteAddRelayNodeEventArgs e) { List<RelayNode> rnList = new List<RelayNode>(); this.GetRelayNodeList(e, rnList); m_Model.RNColl.AddRelayNode("AllotingRN", rnList); }