Example #1
0
        public override void Initialize(Replay replay)
        {
            base.Initialize(replay);
            SetOffsets();
            _viewports = new Dictionary<IViewPort, XnaCameraMan>();
            _boatPathCurve = new Dictionary<ReplayBoat, VertexPositionColor[]>();
            _boatDataRowsCurveMap = new Dictionary<ReplayBoat,SortedList<int,int>>();
            _boatDataRowsDistances = new Dictionary<ReplayBoat, List<float>>();
            _boatPathControlPoints = new Dictionary<ReplayBoat, List<Vector3>>();
            _boatMains = new Dictionary<ReplayBoat, Sail>();
            _boatJibs = new Dictionary<ReplayBoat, Sail>();

            foreach (ReplayBoat boat in replay.Boats)
            {
                _boatPathCurve[boat]=new VertexPositionColor[0];
                _boatDataRowsCurveMap[boat]=new SortedList<int,int>();
                _boatDataRowsDistances[boat]=new List<float>();
                _boatPathControlPoints[boat]=new List<Vector3>();
                _boatMains[boat]=new Sail(Sail.SailType.Main,10, 4, 2, 2);
                _boatJibs[boat]=new Sail(Sail.SailType.Jib, 8, 3, 2,1);
                BuildBoatPathCurve(boat);
            }

            _game = new Game();
            _graphics = new GraphicsDeviceManager(_game);
            _graphics.IsFullScreen = false;
            //_graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(_graphics_PreparingDeviceSettings);
            Resize();
            _content = new ContentManager(_game.Services);
            _content.RootDirectory = "";
            _graphics.DeviceReset += new EventHandler(graphics_DeviceReset);
        }
Example #2
0
 public GraphForm(Replay replay, string statName, List<SelectedStatisticCell> selection, StatisticUnitType unitType)
 {
     if (selection.Count > 0)
     {
         InitializeComponent();
         _replay = replay;
         _statisticName = statName;
         _statistics = selection;
         _unitType = unitType;
         if (selection[0].TackIndex.HasValue)
         {
             _type = StatisticGroupType.Tack;
         }
         else if (selection[0].LegIndex.HasValue)
         {
             _type = StatisticGroupType.Leg;
         }
         else
         {
             _type = StatisticGroupType.Boat;
         }
         WireEvents();
         ConfigureGraph();
         _painter = new Thread(new ThreadStart(this.Run));
         _painter.Start();
     }
     else
     {
         throw new Exception("You must specify at least one statistic");
     }
 }
Example #3
0
 public TimeForm(Replay replay)
 {
     _replay = replay;
     InitializeComponent();
     this.AutoScaleDimensions = new SizeF(182, 216);
     this.AutoScaleMode = AutoScaleMode.Font;
     this.ClientSize = new Size(182, 216);
     //this.MinimumSize = new Size(182, 216);
 }
Example #4
0
 public ViewForm(Replay replay)
 {
     _replay = replay;
     InitializeComponent();
     //Panel.CheckForIllegalCrossThreadCalls = false;
     _createdAt = DateTime.Now;
     RenderTarget.HandleDestroyed += new EventHandler(RenderTarget_HandleDestroyed);
     RenderTarget.HandleCreated += new EventHandler(RenderTarget_HandleCreated);
     
 }
Example #5
0
 public override void Initialize(Replay replay)
 {
     base.Initialize(replay);
     SetOffsets();
     _viewports = new Dictionary<IViewPort, GdiCameraMan>();
     _buffers = new Dictionary<IViewPort, Bitmap>();
     _graphics = new Dictionary<IViewPort, Graphics>();
     _targetGraphics = new Dictionary<IViewPort, Graphics>();
     LoadBoatTracks();
     Resize();
 }
Example #6
0
 public override void Initialize(Replay replay)
 {
     base.Initialize(replay);
 }
Example #7
0
 public StatisticsForm(Replay replay)
 {
     _replay = replay;
     InitializeComponent();
     
 }
Example #8
0
 public virtual void Initialize(Replay replay)
 {
     _replay = replay;
 }
Example #9
0
 public BookMarksForm(Replay replay)
 {
     InitializeComponent();
     _replay = replay;
     LoadBookmarks();
 }
Example #10
0
 public override void Initialize(Replay replay)
 {
     base.Initialize(replay);
 }
Example #11
0
        private void LoadFile()
        {
            //_busy.Show();
            SelectRace sr = new SelectRace();

            sr.Owner = this;
            //BusyDialogManager.HideAll();
            DialogResult editResult   = DialogResult.Cancel;
            DialogResult selectResult = sr.ShowDialog(this);
            Race         race         = sr.SelectedRace;

            //kindof a hack, but it gets file one click file loading working
            if (race.Boats.Count == 0 && _gpsDataFileParameters != null)
            {
                AutoImportGpsDataFileParameters(race);
            }

            while (selectResult != DialogResult.Yes && editResult != DialogResult.Yes && selectResult != DialogResult.Cancel)
            {
                if (selectResult == DialogResult.OK)
                {
                    BusyDialogManager.Show("Loading Race");
                    EditRace er = new EditRace(race);
                    er.Owner = this;
                    BusyDialogManager.Hide();
                    editResult = er.ShowDialog(this);
                }
                if (editResult == DialogResult.OK || (editResult == DialogResult.Cancel && Persistance.Data.Race.Count > 0))//go back to the select dialog
                {
                    selectResult = sr.ShowDialog(this);
                    race         = sr.SelectedRace;
                }
                else if (editResult == DialogResult.Cancel && Persistance.Data.Race.Count == 0)
                {
                    //if there's no other races just cancel everything
                    selectResult = DialogResult.Cancel;
                    break;
                }
            }

            if (selectResult != DialogResult.Cancel)
            {
                BusyDialogManager.Show("Starting Race");

#if RENDERER_AUTO || (!RENDERER_GDI && !RENDERER_XNA && !RENDERER_NULL && !RENDERER_AUTO)
                try
                {
                    _replay = new Replay(race, new XnaRenderer(), new Notify(this.UpdateStatistics), new Notify(this.UpdateTime));
                }
                catch (Exception e)
                {
                    MessageBox.Show("VisualSail encountered an exception intializing the 3D renderer. " + e.Message + Environment.NewLine + "Switching to 2D Renderer");
                    _replay = new Replay(race, new GdiRenderer(), new Notify(this.UpdateStatistics), new Notify(this.UpdateTime));
                }
#endif
#if RENDERER_GDI
                _replay = new Replay(race, new GdiRenderer(), new Notify(this.UpdateStatistics), new Notify(this.UpdateTime));
#endif
#if RENDERER_XNA
                _replay = new Replay(race, new XnaRenderer(), new Notify(this.UpdateStatistics), new Notify(this.UpdateTime));
#endif
#if RENDERER_NULL
                _replay = new Replay(race, new NullRenderer(), new Notify(this.UpdateStatistics), new Notify(this.UpdateTime));
#endif

                _statisticsForm = new StatisticsForm(_replay);
                _timeForm       = new TimeForm(_replay);
                _bookmarkForm   = new BookMarksForm(_replay);
                _replay.Start();

                _statisticsForm.Show(mainDP, DockState.DockBottom);
                double prop = (double)_timeForm.Width / (double)_statisticsForm.Width;
                _bookmarkForm.Show(_statisticsForm.Pane, DockAlignment.Left, prop);
                _timeForm.Show(_bookmarkForm.PanelPane, _bookmarkForm);
                ViewForm vf = (ViewForm)OpenNewViewport();
                vf.DockState = DockState.Document;
                _statisticsForm.CreateDefaultGraphs();

                BusyDialogManager.Hide();
            }
            else
            {
                ShowGettingStarted();
            }
        }
Example #12
0
        private void LoadFile()
        {
            //_busy.Show();
            SelectRace sr = new SelectRace();
            sr.Owner = this;
            //BusyDialogManager.HideAll();
            DialogResult editResult = DialogResult.Cancel;
            DialogResult selectResult=sr.ShowDialog(this);
            Race race = sr.SelectedRace;

            //kindof a hack, but it gets file one click file loading working
            if (race.Boats.Count == 0 && _gpsDataFileParameters != null)
            {
                AutoImportGpsDataFileParameters(race);
            }

            while (selectResult != DialogResult.Yes && editResult != DialogResult.Yes && selectResult != DialogResult.Cancel)
            {
                if (selectResult == DialogResult.OK)
                {
                    BusyDialogManager.Show("Loading Race");
                    EditRace er = new EditRace(race);
                    er.Owner = this;
                    BusyDialogManager.Hide();
                    editResult = er.ShowDialog(this);
                }
                if (editResult == DialogResult.OK || (editResult == DialogResult.Cancel && Persistance.Data.Race.Count > 0))//go back to the select dialog
                {
                    selectResult = sr.ShowDialog(this);
                    race = sr.SelectedRace;
                }
                else if (editResult == DialogResult.Cancel && Persistance.Data.Race.Count == 0)
                {
                    //if there's no other races just cancel everything
                    selectResult = DialogResult.Cancel;
                    break;
                }
            }

            if (selectResult != DialogResult.Cancel)
            {
                BusyDialogManager.Show("Starting Race");

#if RENDERER_AUTO || (!RENDERER_GDI && !RENDERER_XNA && !RENDERER_NULL && !RENDERER_AUTO)
                try
                {
                    _replay = new Replay(race, new XnaRenderer(), new Notify(this.UpdateStatistics), new Notify(this.UpdateTime));
                }
                catch (Exception e)
                {
                    MessageBox.Show("VisualSail encountered an exception intializing the 3D renderer. "+e.Message+Environment.NewLine+"Switching to 2D Renderer");
                    _replay = new Replay(race, new GdiRenderer(), new Notify(this.UpdateStatistics), new Notify(this.UpdateTime));
                }
#endif
#if RENDERER_GDI
                _replay = new Replay(race, new GdiRenderer(), new Notify(this.UpdateStatistics), new Notify(this.UpdateTime));
#endif
#if RENDERER_XNA
                _replay = new Replay(race, new XnaRenderer(), new Notify(this.UpdateStatistics), new Notify(this.UpdateTime));
#endif
#if RENDERER_NULL
                _replay = new Replay(race, new NullRenderer(), new Notify(this.UpdateStatistics), new Notify(this.UpdateTime));
#endif

                _statisticsForm = new StatisticsForm(_replay);
                _timeForm = new TimeForm(_replay);
                _bookmarkForm = new BookMarksForm(_replay);
                _replay.Start();

                _statisticsForm.Show(mainDP, DockState.DockBottom);
                double prop = (double)_timeForm.Width / (double)_statisticsForm.Width;
                _bookmarkForm.Show(_statisticsForm.Pane, DockAlignment.Left, prop);
                _timeForm.Show(_bookmarkForm.PanelPane,_bookmarkForm);
                ViewForm vf = (ViewForm)OpenNewViewport();
                vf.DockState = DockState.Document;
                _statisticsForm.CreateDefaultGraphs();

                BusyDialogManager.Hide();
            }
            else
            {
                ShowGettingStarted();
            }
        }
Example #13
0
 public StatisticsForm(Replay replay)
 {
     _replay = replay;
     InitializeComponent();
 }