public FlightData() { log.Info("Ctor Start"); InitializeComponent(); log.Info("Components Done"); instance = this; // _serializer = new DockStateSerializer(dockContainer1); // _serializer.SavePath = Application.StartupPath + Path.DirectorySeparatorChar + "FDscreen.xml"; // dockContainer1.PreviewRenderer = new PreviewRenderer(); // mymap = gMapControl1; myhud = hud1; MainHcopy = MainH; mymap.Paint += mymap_Paint; // mymap.Manager.UseMemoryCache = false; log.Info("Tunning Graph Settings"); // setup default tuning graph if (MainV2.config["Tuning_Graph_Selected"] != null) { string line = MainV2.config["Tuning_Graph_Selected"].ToString(); string[] lines = line.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); foreach (string option in lines) { chk_box_CheckedChanged((object)(new CheckBox() { Name = option, Checked = true }), new EventArgs()); } } else { chk_box_CheckedChanged((object)(new CheckBox() { Name = "roll", Checked = true }), new EventArgs()); chk_box_CheckedChanged((object)(new CheckBox() { Name = "pitch", Checked = true }), new EventArgs()); chk_box_CheckedChanged((object)(new CheckBox() { Name = "nav_roll", Checked = true }), new EventArgs()); chk_box_CheckedChanged((object)(new CheckBox() { Name = "nav_pitch", Checked = true }), new EventArgs()); } if (MainV2.config.ContainsKey("hudcolor")) { hud1.hudcolor = Color.FromName(MainV2.config["hudcolor"].ToString()); } MainV2.comPort.MavChanged += comPort_MavChanged; log.Info("HUD Settings"); foreach (string item in MainV2.config.Keys) { if (item.StartsWith("hud1_useritem_")) { string selection = item.Replace("hud1_useritem_", ""); CheckBox chk = new CheckBox(); chk.Name = selection; chk.Checked = true; HUD.Custom cust = new HUD.Custom(); cust.Header = MainV2.config[item].ToString(); HUD.Custom.src = MainV2.comPort.MAV.cs; addHudUserItem(ref cust, chk); } } List<string> list = new List<string>(); { list.Add("LOITER_UNLIM"); list.Add("RETURN_TO_LAUNCH"); list.Add("PREFLIGHT_CALIBRATION"); list.Add("MISSION_START"); list.Add("PREFLIGHT_REBOOT_SHUTDOWN"); //DO_SET_SERVO //DO_REPEAT_SERVO } List<string> camList = new List<string>(); { camList.Add("CANNON"); camList.Add("NX500"); camList.Add("NX1100"); camList.Add("WX500"); camList.Add("QX1"); camList.Add("RedEdge"); camList.Add("FLIR"); } CMB_action.DataSource = list; CMB_modes.DataSource = Common.getModesList(MainV2.comPort.MAV.cs); CMB_modes.ValueMember = "Key"; CMB_modes.DisplayMember = "Value"; CMB_CameraSetup.DataSource = camList; CMB_setwp.SelectedIndex = 0; log.Info("Graph Setup"); CreateChart(zg1); // config map log.Info("Map Setup"); gMapControl1.CacheLocation = Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + "gmapcache" + Path.DirectorySeparatorChar; gMapControl1.MapProvider = GMapProviders.GoogleSatelliteMap; gMapControl1.MinZoom = 0; gMapControl1.MaxZoom = 24; gMapControl1.Zoom = 3; gMapControl1.OnMapZoomChanged += new MapZoomChanged(gMapControl1_OnMapZoomChanged); gMapControl1.DisableFocusOnMouseEnter = true; gMapControl1.OnMarkerEnter += gMapControl1_OnMarkerEnter; gMapControl1.OnMarkerLeave += gMapControl1_OnMarkerLeave; gMapControl1.RoutesEnabled = true; gMapControl1.PolygonsEnabled = true; tfrpolygons = new GMapOverlay("tfrpolygons"); gMapControl1.Overlays.Add(tfrpolygons); kmlpolygons = new GMapOverlay("kmlpolygons"); gMapControl1.Overlays.Add(kmlpolygons); geofence = new GMapOverlay("geofence"); gMapControl1.Overlays.Add(geofence); polygons = new GMapOverlay("polygons"); gMapControl1.Overlays.Add(polygons); routes = new GMapOverlay("routes"); gMapControl1.Overlays.Add(routes); rallypointoverlay = new GMapOverlay("rally points"); gMapControl1.Overlays.Add(rallypointoverlay); gMapControl1.Overlays.Add(poioverlay); CamPoints = new GMapOverlay("CamPoints"); gMapControl1.Overlays.Add(CamPoints); FootprintPolyHidden = new GMapOverlay("FootprintPolyHidden"); FootprintPolyVisible = new GMapOverlay("FootprintPolyVisible"); gMapControl1.Overlays.Add(FootprintPolyVisible); try { if (MainV2.getConfig("GspeedMAX") != "") { Gspeed.MaxValue = float.Parse(MainV2.getConfig("GspeedMAX")); } } catch { } MainV2.comPort.ParamListChanged += FlightData_ParentChanged; MainV2.AdvancedChanged += MainV2_AdvancedChanged; // first run MainV2_AdvancedChanged(null, null); }
public FlightData() { log.Info("Ctor Start"); InitializeComponent(); log.Info("Components Done"); instance = this; // _serializer = new DockStateSerializer(dockContainer1); // _serializer.SavePath = Application.StartupPath + Path.DirectorySeparatorChar + "FDscreen.xml"; // dockContainer1.PreviewRenderer = new PreviewRenderer(); // mymap = gMapControl1; myhud = hud1; MainHcopy = MainH; // mymap.Manager.UseMemoryCache = false; log.Info("Tunning Graph Settings"); // setup default tuning graph if (MainV2.config["Tuning_Graph_Selected"] != null) { string line = MainV2.config["Tuning_Graph_Selected"].ToString(); string[] lines = line.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); foreach (string option in lines) { chk_box_CheckedChanged((object)(new CheckBox() { Name = option, Checked = true }), new EventArgs()); } } else { chk_box_CheckedChanged((object)(new CheckBox() { Name = "roll", Checked = true }), new EventArgs()); chk_box_CheckedChanged((object)(new CheckBox() { Name = "pitch", Checked = true }), new EventArgs()); chk_box_CheckedChanged((object)(new CheckBox() { Name = "nav_roll", Checked = true }), new EventArgs()); chk_box_CheckedChanged((object)(new CheckBox() { Name = "nav_pitch", Checked = true }), new EventArgs()); } if (MainV2.config.ContainsKey("hudcolor")) { hud1.hudcolor = Color.FromName(MainV2.config["hudcolor"].ToString()); } log.Info("HUD Settings"); foreach (string item in MainV2.config.Keys) { if (item.StartsWith("hud1_useritem_")) { string selection = item.Replace("hud1_useritem_", ""); CheckBox chk = new CheckBox(); chk.Name = selection; chk.Checked = true; HUD.Custom cust = new HUD.Custom(); cust.Header = MainV2.config[item].ToString(); cust.src = MainV2.comPort.MAV.cs; addHudUserItem(ref cust, chk); } } List<string> list = new List<string>(); { list.Add("LOITER_UNLIM"); list.Add("RETURN_TO_LAUNCH"); list.Add("PREFLIGHT_CALIBRATION"); list.Add("MISSION_START"); list.Add("PREFLIGHT_REBOOT_SHUTDOWN"); //DO_SET_SERVO //DO_REPEAT_SERVO } CMB_action.DataSource = list; CMB_modes.DataSource = Common.getModesList(MainV2.comPort.MAV.cs); CMB_modes.ValueMember = "Key"; CMB_modes.DisplayMember = "Value"; CMB_setwp.SelectedIndex = 0; log.Info("Graph Setup"); CreateChart(zg1); // config map log.Info("Map Setup"); gMapControl1.MapProvider = GMap.NET.MapProviders.GoogleSatelliteMapProvider.Instance; gMapControl1.OnMapZoomChanged += new MapZoomChanged(gMapControl1_OnMapZoomChanged); gMapControl1.DisableFocusOnMouseEnter = true; gMapControl1.Zoom = 3; gMapControl1.RoutesEnabled = true; gMapControl1.PolygonsEnabled = true; kmlpolygons = new GMapOverlay( "kmlpolygons"); gMapControl1.Overlays.Add(kmlpolygons); geofence = new GMapOverlay( "geofence"); gMapControl1.Overlays.Add(geofence); polygons = new GMapOverlay( "polygons"); gMapControl1.Overlays.Add(polygons); routes = new GMapOverlay( "routes"); gMapControl1.Overlays.Add(routes); rallypointoverlay = new GMapOverlay("rally points"); gMapControl1.Overlays.Add(rallypointoverlay); try { if (MainV2.getConfig("GspeedMAX") != "") { Gspeed.MaxValue = float.Parse(MainV2.getConfig("GspeedMAX")); } } catch { } MainV2.comPort.ParamListChanged += FlightData_ParentChanged; if (!Directory.EnumerateDirectories(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"gmapcache" + Path.DirectorySeparatorChar + @"TileDBv3" + Path.DirectorySeparatorChar + @"en" + Path.DirectorySeparatorChar).Any()) { CustomMessageBox.Show("The map cache is empty! Try connecting to the Internet first!"); }//TODO Fix this! (Or, find out what to do) }