private double GetDistance(Transceiver trans, int sectorID, double x, double y) { GeoXYPoint point = new GeoXYPoint(trans.Parent.X + trans.GetAntConfig(sectorID).DX, trans.Parent.Y + trans.GetAntConfig(sectorID).DY); GeoXYPoint point2 = new GeoXYPoint(x, y); return point.Distance(point2); }
/// <summary> /// 画剖面图 /// </summary> /// <param name="cellPoint"></param> /// <param name="receivePoint"></param> private void RefreshProfilePanel(GeoXYPoint cellPoint, GeoXYPoint receivePoint) { try { //m_TransComboBoxSetBySelf = true; //m_TransComboBox.Text = m_CurrentCell.Name; //m_TransComboBoxSetBySelf = false; if (IsValidateParameter(cellPoint, receivePoint)) return; m_ReceptionPowerLabel.Refresh(); ChangeComboBoxValueWithoutEvent(m_TransComboBox, m_CurrentTran.Name); m_CarrierComboBox.Text = m_CurrentCarrier.Name; if (this.m_CellEdgeCoverProbility.Text == "") { this.m_CellEdgeCoverProbility.Text = "0"; } else { this.m_CellEdgeCoverValue = Convert.ToInt32(this.m_CellEdgeCoverProbility.Text); } float cellEdgeCoverProbility = Convert.ToSingle(this.m_CellEdgeCoverValue); bool m_Indoor = cbIndoor.Checked; RxPowerAndLinkLossModel model = new RxPowerAndLinkLossModel(); ReceptPw rPw = m_PointAnalysisCalculator.CalculateReceptPw(out model, m_CurrentCarrier, receivePoint, cellEdgeCoverProbility, m_Indoor, null, null); short[] heights = GetHeighsArr(cellPoint, receivePoint); int distance = (int)(cellPoint.Distance(receivePoint)); int modelID = Tool.GetPropModelConfig(m_CurrentCarrier).PropModelID; string pwString = ""; if (!m_CurrentTran.Active) { pwString = PointAnalyseResource.POINTANALYSE_INFINITY; } else { double rxPower = m_PointAnalysisCalculator.CalculateCellRxPower(receivePoint, m_CurrentCarrier, model.DownLinkLoss); pwString = rxPower.ToString("0.00"); } m_PwString = pwString; string plvString = ""; if (!m_CurrentTran.Active || float.IsNaN(rPw.DlPathLoss)) { plvString = PointAnalyseResource.POINTANALYSE_INFINITY; } else { plvString = rPw.DlPathLoss.ToString(); } m_PlString = plvString; string shadowString = ""; if (!m_CurrentTran.Active || float.IsInfinity(rPw.Shadowloss)) { shadowString = PointAnalyseResource.POINTANALYSE_INFINITY; } else { shadowString = rPw.Shadowloss.ToString(); } string temp = "Rx Power"; m_ReceptionPowerLabel.Text = (m_ResultTypeComboBox.Text == temp ? pwString + "dBm (" : plvString + "dB (") + GetPropModelCollection().Find(delegate(IPropagationModel Propmodel) { return Propmodel.PropModelID == modelID; }) + ") D: " + (distance < 1000 ? distance.ToString() + PointAnalyseResource.POINTANALYSE_UNITS_METER : (distance / 1000.0).ToString() + PointAnalyseResource.POINTANALYSE_UNITS_KM); m_shadowMagrin.Text = string.Format(PointAnalyseResource.POINTANALYSE_SHADOWING, shadowString); //m_ReceptionPowerLabel.Refresh(); //IACell currentCarrier = GetHighestPriorityCell(m_CurrentTran); //if (currentCarrier == null) //{ // return; //} m_ProfilePainter.FreqInfo = m_CurrentCarrier.FreqBand.DLFrequency; m_ProfilePainter.HeightsInfo = heights; //如果挂高不包含建筑高度,那么天线高度需要加上建筑高度,Hata模型中的天线高度为天线相对地面的高度 if (!Huawei.UNet.NE.Interface.AntConfig.IS_ANTENNA_HEIGHT_INCLUDE_BUILDING && GetGdo().IsBuildingLoaded) { IGeoInfo geoInfo = GetGdo().GetGeoInfo; m_ProfilePainter.HTxInfo += geoInfo.GetValueByGeoXYPoint(cellPoint, DemDataType.Building, false); } //m_ProfilePainter.HTxInfo = (m_CurrentTran.AntConfiguration[0]).Height; m_ProfilePainter.HTxInfo = Tool.GetMainAnt(m_CurrentTran).Height; m_ProfilePainter.HRxInfo = 1.5f; short top, bottom; top = short.MinValue; bottom = short.MaxValue; m_ProfilePainter.BorderInfo = new int[] { 0, distance, top, bottom }; m_ProfilePainter.Draw(); } catch (Exception e) { WriteLog.Logger.Error("PointAnalysis Calculate Failed", e); m_EventViewService.WriteLog("PointAnalysis Calculate Failed", LogLevel.Error); } }
public double DistanceAsLineSegmentToPoint(GeoXYPoint point) { if (point == null) { throw new GeoNullException(); } if (!Is2EndPoints(this)) { throw new GeoParamIllegalException("It is not a line."); } double slope = this.Slope; double x = (((Math.Pow(slope, 2.0) * this.m_Points[0].X) + (slope * (point.Y - this.m_Points[0].Y))) + point.X) / (Math.Pow(slope, 2.0) + 1.0); double y = (slope * (x - this.m_Points[0].X)) + this.m_Points[0].Y; GeoXYPoint geoXYPoint = new GeoXYPoint(x, y); if (this.GetMiniEnclosingRect().IsPointInnerGeoXYRect(geoXYPoint)) { return geoXYPoint.Distance(point); } return Math.Min(point.Distance(this.m_Points[0]), point.Distance(this.m_Points[1])); }