public PictureManager(PictureBox pb, Form mainForm, CameraTrack cameraTrack) { m_pictureBox = pb; m_mainForm = mainForm; m_cameraTrack = cameraTrack; This = this; }
public CameraManager(ILocationWatcher lw, CameraTrack cameraTrack) : base(null, null) { m_locationWatcher = lw; m_cameraTrack = cameraTrack; This = this; ffont = Project.getLabelFont(Project.FONT_SIZE_REGULAR + 2); AdjustableArrowCap arrow = new AdjustableArrowCap(3.0f, 7.0f); Project.distancePen.CustomEndCap = arrow; Project.distancePen.CustomStartCap = arrow; AdjustableArrowCap arrowP = new AdjustableArrowCap(3.0f, 7.0f); Project.distancePenPrint.CustomEndCap = arrowP; Project.distancePenPrint.CustomStartCap = arrowP; AdjustableArrowCap arrowM = new AdjustableArrowCap(3.0f, 5.0f); Project.movePointPen.CustomEndCap = arrowM; }
private void MainForm_Load(object sender, System.EventArgs e) { LibSys.StatusBar.WriteLine("On Load"); this.hintsLabel.Text = "Mouse tips:\n\n" + " double click - to recenter\n" + " drag and click inside - to zoom\n" + " right click on map for more options\n" + " press F1 for Help\n" + " check out Help->Sample Files menu\n"; #if !DEBUG //gridCheckBox.Visible = false; vehCheckBox.Visible = false; #endif Project.favoritesFirstIndex = this.favMainMenuItem.MenuItems.Count; Project.recentFilesFirstIndex = this.fileMainMmenuItem.MenuItems.Count; Project.toolsFirstIndex = this.toolsMainMenuItem.MenuItems.Count; backLinkLabel.Enabled = false; forwardLinkLabel.Enabled = false; ProgressMonitor.Indicator = progressButton; progressButton.Text = ""; this.Text = Project.PROGRAM_NAME_HUMAN; //this.hintsPanel.BackColor = System.Drawing.Color.FromArgb(255, Color.Navy); if(m_firstTime) { this.notAssociatedButton.Visible = true; this.notAssociatedLabel.Visible = true; } else { // first time the greeting does not start, so HideGreeting will not set hintsPanel to visible this.hintsPanel.Visible = Project.showHelpAtStart && !hintsPanelClicked; } // good place to have camera coordinates set here, if supplied in command line: // /lat=34.123 /lon=-117.234 /elev=5000 /map=aerial (topo,color) processArgs(); // we need it as early as possible, before first web load - TileCache.init(Project.CGIBINPTR_URL) below - occured. Project.ApplyGlobalHTTPProxy(false); if(Project.mainFormMaximized) { this.WindowState = System.Windows.Forms.FormWindowState.Maximized; } else if(Project.fitsScreen(Project.mainFormX, Project.mainFormY, Project.mainFormWidth, Project.mainFormHeight) && Project.mainFormWidth > 300 && Project.mainFormHeight > 200) { this.Location = new Point(Project.mainFormX, Project.mainFormY); this.ClientSize = new System.Drawing.Size(Project.mainFormWidth, Project.mainFormHeight); // causes Resize() //this.Bounds = new System.Drawing.Rectangle(Project.mainFormX, Project.mainFormY, Project.mainFormWidth, Project.mainFormHeight); } reliefCheckBox.Checked = Project.drawRelief; overlayCheckBox.Checked = Project.terraUseOverlay; gridCheckBox.Enabled = Project.drawRelief || Project.drawTerraserver; citiesCheckBox.Enabled = Project.drawRelief; gridCheckBox.Checked = Project.drawGrid; if(Project.drawTerraserver) { if(Project.drawTerraserverMode.Equals("aerial")) { aerialCheckBox.Checked = true; } else if(Project.drawTerraserverMode.Equals("color aerial")) { colorAerialCheckBox.Checked = true; } else if(Project.drawTerraserverMode.Equals("topo")) { topoCheckBox.Checked = true; overlayCheckBox.Enabled = false; } lmCheckBox.Enabled = true; } else { Project.terraserverAvailable = false; aerialCheckBox.Checked = false; colorAerialCheckBox.Checked = false; topoCheckBox.Checked = false; lmCheckBox.Enabled = false; } //opacityPanel.Visible = Project.drawTerraserver; citiesCheckBox.Checked = Project.drawCities; lmCheckBox.Checked = Project.drawLandmarks; eqCheckBox.Checked = Project.drawEarthquakes; eqStylePanelVisible(Project.drawEarthquakes); wptCheckBox.Checked = Project.drawWaypoints; vehCheckBox.Checked = Project.drawVehicles; TileCache.init(Project.CGIBINPTR_URL); // try to reach the QuakeMap server if(TileCache.ZipcodeServer == null) { setInternetAvailable(false); this.hintsLabel.Text = "\n[offline]\n\nuse Internet-->Offline\n or Map-->Options-->Proxy menu\nif you think you should be connected\n "; string message = "\nWarning: couldn't reach server: " + Project.PROGRAM_MAIN_SERVER + "\n\nWorking offline.\n "; if(m_greetingForm == null) { Project.ErrorBox(null, message); } else { Point popupOffset = new Point(34, 230); Point screenPoint = m_greetingForm.PointToScreen(popupOffset); Project.ShowPopup (m_greetingForm, message, screenPoint); } } else { setInternetAvailable(true); } m_cameraTrack = new CameraTrack(); m_cameraManager = new CameraManager(this, m_cameraTrack); m_pictureManager = new PictureManager(mainPictureBox, this, m_cameraTrack); m_cameraManager.init(m_pictureManager); m_pictureManager.init(m_cameraManager); if(Project.hasOldTerrafolderStyleFiles()) { HideGreeting(); Project.AttemptTerrafolderMigration(); } findLinkLabel.Focus(); // on the very first run, bring up "Find by zipcode" window and try positioning // the map there: if(m_firstTime && TileCache.ZipcodeServer != null) { Project.findKeyword = Project.zipcode; FindForm findForm = new FindForm(m_cameraManager, true); findForm.ShowDialog(); } LibSys.StatusBar.WriteLine("IP: running init thread"); //add dt worker method to the thread pool / queue a task //Project.threadPool.PostRequest (new WorkRequestDelegate (runInit), "MainForm init"); //ThreadPool2.QueueUserWorkItem(new WaitCallback (runInit), "MainForm init"); runInit("MainForm init"); //ThreadPool2.QueueUserWorkItem(new WaitCallback (timeEater), "MainForm timeEater"); periodicMaintenanceTimer = new System.Windows.Forms.Timer(); periodicMaintenanceTimer.Interval = 1200; periodicMaintenanceTimer.Tick += new EventHandler(periodicMaintenance); periodicMaintenanceTimer.Start(); LibSys.StatusBar.WriteLine("OK: Maintenance ON"); if(!Project.showHelpAtStart) { if(!hasShownUpdateForm && Project.upgradeMessage.Length > 0) { hasShownUpdateForm = true; new DlgUpgradeMessage(Project.upgradeMessage).ShowDialog(); } } inResize = false; LibSys.StatusBar.WriteLine("On Load done"); }
public DlgPdaExport(CameraTrack cameraTrack) { m_cameraTrack = cameraTrack; m_defaultFileName = "pmapdata" + m_defaultExt; InitializeComponent(); if(m_selectedFileName == null) { m_selectedFileName = Path.Combine(Project.pdaInitialDirectory, m_defaultFileName); } fileTextBox.Text = m_selectedFileName; saveButton.Enabled = fileTextBox.Text.Length > 0; setRadioButtons(); Project.setDlgIcon(this); }
private void logCamtrackFrame() { if (Project.camTrackOn) { CameraTrack cameraTrack = WaypointsCache.CameraManager.CameraTrack; XmlDocument xmlDoc = cameraTrack.XmlDoc; XmlNode wNode = xmlDoc.CreateNode(XmlNodeType.Element, "waypoints", null); XmlAttribute attr = xmlDoc.CreateAttribute("description"); attr.InnerText = "Waypoints: " + DateTime.Now; wNode.Attributes.Append(attr); XmlNode tNode = xmlDoc.CreateNode(XmlNodeType.Element, "trackpoints", null); attr = xmlDoc.CreateAttribute("description"); attr.InnerText = "Trackpoints: " + DateTime.Now; tNode.Attributes.Append(attr); ArrayList trackIds = new ArrayList(); SortedList tmpList = new SortedList(); // trackpoints are added to tmplist, other waypoints are added directly to <waypoints>: foreach (Waypoint wpt in WaypointsCache.WaypointsDisplayed) { try { if (wpt.TrackId != -1) { tmpList.Add(wpt.DateTime, wpt); } else { XmlNode wptNode = wpt.ToCamtrackXmlNode(xmlDoc); wNode.AppendChild(wptNode); } } // we will probably lose some trackpoints (with same time, up to second). The benefit is that we will have a sorted list. #if DEBUG catch (Exception e) { LibSys.StatusBar.Error("" + e); } #else catch { } #endif } attr = xmlDoc.CreateAttribute("count"); attr.InnerText = "" + wNode.ChildNodes.Count; wNode.Attributes.Append(attr); cameraTrack.log(wNode); // now convert trackpoints list to nodes under <trackpoints> for (int i = 0; i < tmpList.Count; i++) { Waypoint wpt = (Waypoint)tmpList.GetByIndex(i); XmlNode wptNode = wpt.ToCamtrackXmlNode(xmlDoc); tNode.AppendChild(wptNode); if (!trackIds.Contains(wpt.TrackId)) { trackIds.Add(wpt.TrackId); } } tmpList.Clear(); attr = xmlDoc.CreateAttribute("count"); attr.InnerText = "" + tNode.ChildNodes.Count; tNode.Attributes.Append(attr); cameraTrack.log(tNode); // make a list of track IDs used by trackpoints under <tracks>: XmlNode node = xmlDoc.CreateNode(XmlNodeType.Element, "tracks", null); foreach (long trackId in trackIds) { Track trk = WaypointsCache.getTrackById(trackId); if (trk != null) { XmlNode trkNode = xmlDoc.CreateNode(XmlNodeType.Element, "trk", null); attr = xmlDoc.CreateAttribute("trkid"); attr.InnerText = "" + trk.Id; trkNode.Attributes.Append(attr); trkNode.InnerText = trk.Name; node.AppendChild(trkNode); } } attr = xmlDoc.CreateAttribute("count"); attr.InnerText = "" + node.ChildNodes.Count; node.Attributes.Append(attr); cameraTrack.log(node); } }