Пример #1
0
 public PhotoManager()
 {
     InitializeComponent();
     _lake = Lake.FindAll()[0];
     LoadBoats();
     LoadPhotos();
 }
Пример #2
0
 public Course(string name, DateTime date, Lake lake)
 {
     _name                = name;
     _date                = date;
     _lakeId              = lake.Id;
     _directionType       = WindDirectionType.ConstantManual;
     _manualWindDirection = 0.0;
     _new     = true;
     _changed = true;
 }
Пример #3
0
 public Course(string name,DateTime date, Lake lake)
 {
     _name = name;
     _date = date;
     _lakeId = lake.Id;
     _directionType = WindDirectionType.ConstantManual;
     _manualWindDirection = 0.0;
     _new = true;
     _changed = true;
 }
Пример #4
0
        public static List <Course> FindAllByLake(Lake lake)
        {
            var query = from r in Persistance.Data.Course.AsEnumerable()
                        where (int)r["lake_id"] == lake.Id
                        select r;

            List <Course> courses = new List <Course>();

            foreach (SkipperDataSet.CourseRow rr in query)
            {
                courses.Add(new Course(rr));
            }
            return(courses);
        }
Пример #5
0
        public Race(string name, Lake lake, Course course, DateTime start, DateTime end)
        {
            _name          = name;
            _lakeId        = lake.Id;
            _courseId      = course.Id;
            _start         = start;
            _end           = end;
            _startSequence = new TimeSpan(0, 0, 0);
            SetReplayTimes();
            _boats = new List <Boat>();

            _new     = true;
            _changed = true;
        }
Пример #6
0
        public Race(string name, Lake lake, Course course, DateTime start, DateTime end)
        {
            _name = name;
            _lakeId = lake.Id;
            _courseId = course.Id;
            _start = start;
            _end = end;
            _startSequence = new TimeSpan(0, 0, 0);
            SetReplayTimes();
            _boats = new List<Boat>();

            _new = true;
            _changed = true;
        }
Пример #7
0
 public EditCourses(Race race)
 {
     this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
     InitializeComponent();
     LoadPaths(race);
     _lake = race.Lake;
     try
     {
         _image = AmphibianSoftware.VisualSail.Library.SatelliteImageryHelper.GetImageForLake(_lake);
     }
     catch (Exception)
     {
         _image = null;
     }
     
     _course = race.Course;
     LoadCourse();
 }
Пример #8
0
        private Lake AutoGenerateLake()
        {
            CoordinatePoint nw=null;
            CoordinatePoint se=null;
            double altitude=0;
            if (FindGpsBounds(ref nw, ref se, ref altitude))
            {
                double minLat = se.Latitude.Value;
                double maxLat = nw.Latitude.Value;
                double minLong = nw.Longitude.Value;
                double maxLong = se.Longitude.Value;

                List<Lake> existingLakes = Lake.FindByBoundingBox(minLat, maxLat, minLong, maxLong);
                if (existingLakes.Count > 0)
                {
                    return existingLakes[0];
                }
                else
                {
                    Lake l;
                    if (CheckForExistingLakeImagery(ref minLat, ref maxLat, ref minLong, ref maxLong).Count == 0)
                    {
                        //no existing images, so we just take a guess at the size we want
                        double padding = 0.05;//this is totally arbitrary based on what looked right
                        l = new Lake(Lake.DefaultName, maxLat + padding, minLat - padding, maxLong + padding, minLong - padding, altitude, "", TimeZoneInfo.Local);
                    }
                    else
                    {
                        //images already exist locally, so we leave the numbers alone
                        l = new Lake(Lake.DefaultName, maxLat, minLat, maxLong, minLong, altitude, "", TimeZoneInfo.Local);
                    }
                    l.Save();
                    return l;
                }
            }
            else
            {
                //throw new Exception("Failed to generate lake");
                return null;
            }
        }
Пример #9
0
 public LakeResizeControl(Lake lake)
 {
     InitializeComponent();
     _lake = lake;
 }
        public static Image GetImageForLake(Lake lake)
        {
            Image satelite;
            if (!File.Exists(ContentHelper.DynamicContentPath + AmphibianSoftware.VisualSail.Library.SatelliteImageryHelper.GetFileName(lake.North, lake.South, lake.East, lake.West)))
            {
                string lakeFile = SatelliteImageryHelper.GetSatelliteImage(lake.North, lake.South, lake.East, lake.West, (int)lake.WidthInMeters / 50, (int)lake.HeightInMeters / 50);
                FileInfo fi = new FileInfo(lakeFile);
                fi.MoveTo(ContentHelper.DynamicContentPath + SatelliteImageryHelper.GetFileName(lake.North, lake.South, lake.East, lake.West));
                satelite = Image.FromFile(ContentHelper.DynamicContentPath + SatelliteImageryHelper.GetFileName(lake.North, lake.South, lake.East, lake.West));
            }
            else
            {
                satelite = Image.FromFile(ContentHelper.DynamicContentPath + AmphibianSoftware.VisualSail.Library.SatelliteImageryHelper.GetFileName(lake.North, lake.South, lake.East, lake.West));
            }

            return satelite;
        }
Пример #11
0
        public static List<Course> FindAllByLake(Lake lake)
        {
            var query = from r in Persistance.Data.Course.AsEnumerable()
                        where (int)r["lake_id"] == lake.Id
                        select r;

            List<Course> courses = new List<Course>();
            foreach (SkipperDataSet.CourseRow rr in query)
            {
                courses.Add(new Course(rr));
            }
            return courses;
        }
Пример #12
0
 private void zoomOutBTN_Click(object sender, EventArgs e)
 {
     _zoomed = false;
     _zoomedLake = null;
     ClearCache();
     zoomInCB.Checked = false;
     lakePNL.Invalidate();
     lakePNL.Cursor = Cursors.Arrow;
 }
Пример #13
0
        private void lakePNL_MouseUp(object sender, MouseEventArgs e)
        {
            _mouseDown = false;
            if (zoomInCB.Checked)
            {
                _zoomSecondPoint = new Point(e.X, e.Y);
                CoordinatePoint a = ScreenToCoordinates(_zoomFirstPoint);
                CoordinatePoint b = ScreenToCoordinates(_zoomSecondPoint);

                double minLat;
                double maxLat;
                double minLon;
                double maxLon;

                if (a.Latitude.Value < b.Latitude.Value)
                {
                    minLat = a.Latitude.Value;
                    maxLat = b.Latitude.Value;
                }
                else
                {
                    maxLat = a.Latitude.Value;
                    minLat = b.Latitude.Value;
                }

                if (a.Longitude.Value < b.Longitude.Value)
                {
                    minLon = a.Longitude.Value;
                    maxLon = b.Longitude.Value;
                }
                else
                {
                    maxLon = a.Longitude.Value;
                    minLon = b.Longitude.Value;
                }

                _zoomedLake = new Lake(_lake.Name, maxLat, minLat, maxLon,minLon, _lake.Altitude, "", _lake.TimeZone);

                zoomInCB.Checked = false;
                _zoomed = true;
                lakePNL.Cursor = Cursors.Arrow;
            }
            ClearCache();
            lakePNL.Invalidate();
        }