Пример #1
0
 private void AddNode(ReceiveAISEventArgs e)
 {
     RadarItem item = new RadarItem(e, ITEM_SIZE);
     UpdateRadians(item, e.GpsLocation);
     _radar.AddItem(item);
     lock (itemRegister)
     {
         itemRegister.Add(item.ID, item);
     }
 }
 public int CompareTo(RadarItem item)
 {
     return 0;
 }
Пример #3
0
 public int CompareTo(RadarItem item)
 {
     return this.ID.CompareTo(item.ID);
 }
Пример #4
0
        public void AddItem(RadarItem item)
        {
            bool bFlag = true;

            for (int i = 0; i < radarItemList.Count; i++)
            {
                //Ha létezik az elem, akkor azt frissíti és nem hoz létre újat
                if (radarItemList[i].ID == item.ID)
                {
                    radarItemList[i] = item;
                    bFlag = false;
                }
            }

            if (bFlag)
                radarItemList.Add(item);

            Draw();
        }
Пример #5
0
 public void AddItem(RadarItem item)
 {
     bool bFlag = true;
     for (int i = 0; i < radarItemList.Count; i++)
     {
         if (radarItemList[i].ID == item.ID)
         {
             radarItemList[i] = item;
             bFlag = false;
             break;
         }
     }
     if (bFlag)
         radarItemList.Add(item);
     Draw();
 }
Пример #6
0
 private void UpdateRadians(RadarItem item, GpsLocation remoteLoc)
 {
     GpsLocation localLoc = GPSUnit.Instance.Location;
     /*double g = remoteLoc.Longitude - localLoc.Longitude;
     double grad = g / RADIANS_MAGIC_NUMBER;
     double nrad = localLoc.Longitude / RADIANS_MAGIC_NUMBER;
     double lrad = localLoc.Latitude / RADIANS_MAGIC_NUMBER;
     double srad = remoteLoc.Longitude / RADIANS_MAGIC_NUMBER;
     #if TRACE
     Trace.WriteLine(String.Format("localLoc: {0}", localLoc));
     Trace.WriteLine(String.Format("remoteLoc: {0}", remoteLoc));
     Trace.WriteLine(String.Format("grad={0}, nrad={1}, lrad={2}, srad={3}", grad, nrad, lrad, srad));
     #endif
     double azi = (Math.PI - (-Math.Atan((Math.Tan(grad) / Math.Sin(lrad)))));
     item.Azimuth = azi * RADIANS_MAGIC_NUMBER;
     double a = Math.Cos(grad);
     double b = Math.Cos(lrad);
     double ele = Math.Atan((a * b) / (Math.Sqrt(1 - (a * a) * (b * b))));
     //item.Elevation = ele > 0 ? ele : -ele * RADIANS_DIVISOR;
     item.Elevation = ele * RADIANS_MAGIC_NUMBER;
     #if TRACE
     Trace.WriteLine(String.Format("azi={0},ele={1}", azi, ele));
     Trace.WriteLine(String.Format("item.Azimuth={0}, item.Elevation={1}", item.Azimuth, item.Elevation));
     #endif
      */
     item.Azimuth = remoteLoc.Latitude - localLoc.Latitude * 50;
     double y = remoteLoc.Longitude - localLoc.Longitude * 1.5;
     item.Elevation = y < 0 ? -y : y;
 }