Exemplo n.º 1
0
        private void timezoneCB_SelectedIndexChanged(object sender, EventArgs e)
        {
            Lake lake = _race.Lake;

            lake.TimeZone = (TimeZoneInfo)timezoneCB.SelectedItem;
            lake.Save();
            LoadRace();
            LoadBoats();
            UpdateValidGpsDataRange();
        }
Exemplo n.º 2
0
        private void existingBTN_Click(object sender, EventArgs e)
        {
            CoordinatePoint nw  = null;
            CoordinatePoint se  = null;
            double          alt = 0;

            if (FindGpsBounds(ref nw, ref se, ref alt))
            {
                double        minLat  = se.Latitude.Value;
                double        maxLat  = nw.Latitude.Value;
                double        minLong = nw.Longitude.Value;
                double        maxLong = se.Longitude.Value;
                List <string> paths   = CheckForExistingLakeImagery(ref minLat, ref maxLat, ref minLong, ref maxLong);
                if (paths.Count > 0)
                {
                    ExistingImageSelect eis = new ExistingImageSelect(paths);
                    eis.ShowDialog();
                    if (eis.SelectedPath != "")
                    {
                        FileInfo fi   = new FileInfo(eis.SelectedPath);
                        string   name = fi.Name;
                        DecodeImageFileName(name, out minLat, out maxLat, out minLong, out maxLong);
                        Lake l = _race.Lake;
                        l.South = minLat;
                        l.North = maxLat;
                        l.West  = minLong;
                        l.East  = maxLong;
                        l.Save();
                        lakeResizer.Lake = l;
                    }
                }
                else
                {
                    MessageBox.Show("No Suitable Cached Images Found");
                }
            }
            else
            {
                MessageBox.Show("Could not determine a region for the gps data, make sure at least one boat had gps data.");
            }
        }
Exemplo n.º 3
0
        private void LakeResizeControl_MouseUp(object sender, MouseEventArgs e)
        {
            if (_lake != null)
            {
                _mouseDown     = false;
                _mousePosition = new Point(e.X, e.Y);
                if (_selectedCorner.HasValue)
                {
                    switch (_selectedCorner.Value)
                    {
                    case SelectedCorner.BottomLeft:
                        CoordinatePoint bl = ScreenToCoordinates(_mousePosition);
                        if (_gpsBoundsNorthWest != null && _gpsBoundsSouthEast != null)
                        {
                            if (bl.Latitude.Value < _gpsBoundsSouthEast.Latitude.Value)
                            {
                                _lake.South = bl.Latitude.Value;
                            }
                            else
                            {
                                _lake.South = _gpsBoundsSouthEast.Latitude.Value;
                            }
                            if (bl.Longitude.Value < _gpsBoundsNorthWest.Longitude.Value)
                            {
                                _lake.West = bl.Longitude.Value;
                            }
                            else
                            {
                                _lake.West = _gpsBoundsNorthWest.Longitude.Value;
                            }
                        }
                        else
                        {
                            _lake.South = bl.Latitude.Value;
                            _lake.West  = bl.Longitude.Value;
                        }
                        break;

                    case SelectedCorner.BottomRight:
                        CoordinatePoint br = ScreenToCoordinates(_mousePosition);
                        if (_gpsBoundsNorthWest != null && _gpsBoundsSouthEast != null)
                        {
                            if (br.Latitude.Value < _gpsBoundsSouthEast.Latitude.Value)
                            {
                                _lake.South = br.Latitude.Value;
                            }
                            else
                            {
                                _lake.South = _gpsBoundsSouthEast.Latitude.Value;
                            }
                            if (br.Longitude.Value > _gpsBoundsSouthEast.Longitude.Value)
                            {
                                _lake.East = br.Longitude.Value;
                            }
                            else
                            {
                                _lake.East = _gpsBoundsSouthEast.Longitude.Value;
                            }
                        }
                        else
                        {
                            _lake.South = br.Latitude.Value;
                            _lake.East  = br.Longitude.Value;
                        }
                        break;

                    case SelectedCorner.TopLeft:
                        CoordinatePoint tl = ScreenToCoordinates(_mousePosition);
                        if (_gpsBoundsNorthWest != null && _gpsBoundsSouthEast != null)
                        {
                            if (tl.Latitude.Value > _gpsBoundsNorthWest.Latitude.Value)
                            {
                                _lake.North = tl.Latitude.Value;
                            }
                            else
                            {
                                _lake.North = _gpsBoundsNorthWest.Latitude.Value;
                            }
                            if (tl.Longitude.Value < _gpsBoundsNorthWest.Longitude.Value)
                            {
                                _lake.West = tl.Longitude.Value;
                            }
                            else
                            {
                                _lake.West = _gpsBoundsNorthWest.Longitude.Value;
                            }
                        }
                        else
                        {
                            _lake.North = tl.Latitude.Value;
                            _lake.West  = tl.Longitude.Value;
                        }
                        break;

                    case SelectedCorner.TopRight:
                        CoordinatePoint tr = ScreenToCoordinates(_mousePosition);
                        if (_gpsBoundsNorthWest != null && _gpsBoundsSouthEast != null)
                        {
                            if (tr.Latitude.Value > _gpsBoundsNorthWest.Latitude.Value)
                            {
                                _lake.North = tr.Latitude.Value;
                            }
                            else
                            {
                                _lake.North = _gpsBoundsNorthWest.Latitude.Value;
                            }
                            if (tr.Longitude.Value > _gpsBoundsSouthEast.Longitude.Value)
                            {
                                _lake.East = tr.Longitude.Value;
                            }
                            else
                            {
                                _lake.East = _gpsBoundsSouthEast.Longitude.Value;
                            }
                        }
                        else
                        {
                            _lake.North = tr.Latitude.Value;
                            _lake.East  = tr.Longitude.Value;
                        }
                        break;
                    }
                    _lake.Save();
                    UpdateImage();
                    this.Invalidate();
                }
            }
        }