Example #1
0
 /// <summary>
 /// Add one record to the table
 /// </summary>
 /// <param name="rec"></param>
 public string Add(navRec rec)
 {
     if (rec != null)
     {
         return(m_db.Add(rec));
     }
     return("");
 }
Example #2
0
        /// <summary>
        /// Returns a subtable with items that match the given criteria
        /// </summary>
        /// <param name="rangeLimitNm">Range Limit in nm</param>
        /// <param name="Lat">Center Lat (decimal)</param>
        /// <param name="Lon">Center Lon (decimal)</param>
        /// <param name="navTypes">Type of nav items to include</param>
        /// <returns>A table with selected records</returns>
        public navTable GetSubtable(double rangeLimitNm, double Lat, double Lon, NavTypes[] navTypes = null)
        {
            if (navTypes == null)
            {
                navTypes = new NavTypes[] { NavTypes.All }
            }
            ;

            var nT    = new navTable( );
            var myLoc = new LatLon(Lat, Lon);

            foreach (var rec in this)
            {
                var dist = myLoc.DistanceTo(new LatLon(double.Parse(rec.Value.lat), double.Parse(rec.Value.lon)), ConvConsts.EarthRadiusNm);
                if ((dist <= rangeLimitNm) && (rec.Value.IsTypeOf(navTypes)))
                {
                    nT.Add(rec.Value);
                }
            }
            return(nT);
        }
    }