private void btnGetLocation_Click(object sender, EventArgs e) { // Convert the click on the map into a point Geometry. try { location = _taskUI.E2.CurrentView.TrackPoint(); txtLocation.Text = FormatPointCoords(location); txtLocation.Tag = location; LoadStreetViewQuery(); } catch (Exception error) { System.Diagnostics.Debug.WriteLine(error.ToString()); } }
private void DoFind() { if (txtLocation.Tag != null) { bool validPoint = CheckQueryResponse(); if (!validPoint) { _taskUI.E2.MessageBox("No Image found at this location, please select another location.", "StreetViewer", esriE2MessageBoxType.Information); location = _taskUI.E2.CurrentView.TrackPoint(); txtLocation.Text = FormatPointCoords(location); txtLocation.Tag = location; //this.btnFind.Enabled = (this.txtLocation.Text.Length > 0); LoadStreetViewQuery(); return; } TaskContext newTaskContext = new ESRI.ArcGIS.E2API.TaskContext(); newTaskContext.TaskName = typeof(StreetViewer.CustomTask).FullName; newTaskContext.TaskUIName = _taskUI.Name; ESRI.ArcGIS.E2API.ParameterSet parameters = new ESRI.ArcGIS.E2API.ParameterSet(); parameters.SetParameter("Geometry", txtLocation.Tag); parameters.SetParameter("COORDS", txtLocation.Text); newTaskContext.UpdateParameters(parameters); _taskUI.E2.ProcessTask(newTaskContext, esriE2TaskExecution.Show); txtLocation.Text = ""; txtLocation.Tag = null; txtLocation.Refresh(); } }
private void txtLocation_DragDrop(object sender, DragEventArgs e) { // Using the IDataObject interface, check the data type again and then retrieve the // data of the drag operation from the DragEventArgs IDataObject data = e.Data; bool foundData = data.GetDataPresent(_dataFormat); if (foundData) { PlaceResult res = GetResultFromDragData(data); AddResultToTextBox(res); location = res.Geometry as ESRI.ArcGIS.E2API.Point; //****set location so it’s not null LoadStreetViewQuery();//****call method } }
private void SetTag(string plc) { plc = plc.Replace("(historical)", ""); string Urlstring4; Urlstring4 = "http://ws.geonames.org/search?q=" + plc; XmlDocument _doc4 = new XmlDocument(); _doc4.Load(Urlstring4); XPathNavigator nav4 = _doc4.CreateNavigator(); XPathNavigator node4 = nav4.SelectSingleNode("/geonames/geoname/lat"); String nodeLat = node4.InnerXml; node4 = nav4.SelectSingleNode("/geonames/geoname/lng"); string nodeLng = node4.InnerXml; ESRI.ArcGIS.E2API.Point location = new ESRI.ArcGIS.E2API.Point(Convert.ToDouble(nodeLng), Convert.ToDouble(nodeLat)); txtLocation.Tag = location; }