Exemplo n.º 1
0
        /// <summary>
        /// 计算两点之间距离
        /// </summary>
        /// <param name="fromCoordinate">起始点坐标</param>
        /// <param name="toCoordinate">终止点坐标</param>
        /// <returns>两点之间距离(单位:km)</returns>
        public static double GetKmDistance(EMCGeographyCoordinate fromCoordinate, EMCGeographyCoordinate toCoordinate)
        {
            double dalg = 0.0;
            double dala = 0.0;
            double dblg = 0.0;
            double dbla = 0.0;

            if (fromCoordinate != null)
            {
                dalg = 2 * PI * fromCoordinate.Longitude.Value / 360;
                dala = 2 * PI * fromCoordinate.Latitude.Value / 360;
            }
            if (toCoordinate != null)
            {
                dblg = 2 * PI * toCoordinate.Longitude.Value / 360;
                dbla = 2 * PI * toCoordinate.Latitude.Value / 360;
            }

            double result = earthRadius * Math.Sqrt((dbla - dala) * (dbla - dala) + (dblg - dalg) * (dblg - dalg) * Math.Cos(dbla) * Math.Cos(dbla));

            if (result < minDistance)
            {
                result = minDistance;
            }
            return(result);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="equipID">所属设备编号</param>
 /// <param name="freq">发射频率</param>
 /// <param name="transmitter">发射机参数</param>
 /// <param name="coordinate">地理坐标</param>
 public Transmitter(string equipID, ComparableFreq freq, TransmitterParams transmitter, EMCGeographyCoordinate coordinate)
 {
     this.equipID           = equipID;
     this.freqValue         = freq;
     this.transmitterParams = transmitter;
     this.coordinate        = coordinate;
 }
Exemplo n.º 3
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="equipID">设备编号</param>
 /// <param name="freqValue">接收机频率</param>
 /// <param name="receiverParams">接收机参数</param>
 /// <param name="coordinate">接收机坐标</param>
 public Receiver(string equipID, ComparableFreq freqValue, ReceiverParams receiverParams, EMCGeographyCoordinate coordinate)
 {
     this.equipID        = equipID;
     this.receiverParams = receiverParams;
     this.freqValue      = freqValue;
     this.coordinate     = coordinate;
 }