private void button2_ClickOld(object sender, EventArgs e) { Double lo = 0; Double la = 0; String loc = ""; GMap.NET.WindowsForms.GMapOverlay markers1 = new GMap.NET.WindowsForms.GMapOverlay("markers1"); foreach (DataGridViewRow drrow in dataGridView1.SelectedRows) { Double.TryParse(drrow.Cells["Longitude"].Value.ToString(), out lo); Double.TryParse(drrow.Cells["Latitude"].Value.ToString(), out la); loc = drrow.Cells["Longitude"].Value.ToString() + " , " + drrow.Cells["Latitude"].Value.ToString(); GMap.NET.WindowsForms.GMapMarker marker1 = ( new GMap.NET.WindowsForms.Markers.GMarkerGoogle( new GMap.NET.PointLatLng(la, lo), new Bitmap("ico\\3-min.png"))); //GMap.NET.WindowsForms.Markers.GMarkerGoogleType.blue_pushpin)); marker1.Tag = drrow.Cells["Address"].Value.ToString(); markers1.Markers.Add(marker1); } /// markers.Markers.Add(marker); gMap.Overlays.Add(markers1); gMap.SetPositionByKeywords(loc); gMap.ZoomAndCenterMarkers(loc); gMap.Position = new GMap.NET.PointLatLng(la, lo); }
private void gMapControl1_OnMarkerClick(GMap.NET.WindowsForms.GMapMarker item, MouseEventArgs e) { cmbTPISelect.SelectedItem = item.ToolTipText; txtInfo.Clear(); txtInfo.AppendText("ТПИ " + item.ToolTipText + "\r\n"); if (TPIs[item.ToolTipText].Online) { txtInfo.AppendText("Статус: Онлайн\r\n"); } else { txtInfo.AppendText("Статус: Оффлайн\r\n"); } txtInfo.AppendText("Напряжение бортовой сети - " + String.Format("{0:0.0}", TPIs[item.ToolTipText].Voltage) + " вольт\r\n"); txtInfo.AppendText("Координаты:\r\n"); txtInfo.AppendText("Широта - " + TPIs[item.ToolTipText].gps_y + "\r\n"); txtInfo.AppendText("Долгота - " + TPIs[item.ToolTipText].gps_x + "\r\n"); txtInfo.AppendText("Время по внутренним часам - " + TPIs[item.ToolTipText].gps_time + "\r\n"); picImage.Load("http://172.16.160.53:8020/preview?modem-id=" + item.ToolTipText); picImage.Refresh(); }
private void gMap_OnMarkerClick(GMap.NET.WindowsForms.GMapMarker item, MouseEventArgs e) { //Console.WriteLine(String.Format("Marker {0} was clicked.", item.Tag)); MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result; string[] words; string[] stringSep; stringSep = new string[] { "+-+" };; words = item.Tag.ToString().Split(stringSep, StringSplitOptions.RemoveEmptyEntries); //string message = item.Tag.ToString(); string message = words[0]; string caption = "Επιλογή Πρατηρίου"; //MessageBox.Show(item.Tag.ToString()); result = MessageBox.Show(this, message, caption, buttons, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign); if (result == DialogResult.Yes) { int tmpid; Int32.TryParse(words[1], out tmpid); GleoPass.id = tmpid; GleoPass.address = words[0]; Close(); } }
private GMap.NET.WindowsForms.GMapMarker MarkerInInitialPos() { GMap.NET.WindowsForms.GMapMarker marker1 = ( new GMap.NET.WindowsForms.Markers.GMarkerGoogle( new GMap.NET.PointLatLng(GlobLat, GlobLon), GMap.NET.WindowsForms.Markers.GMarkerGoogleType.purple_small)); marker1.Tag = 0; return(marker1); }
private void SetMarkers2All() { Double lo = 0; Double la = 0; Int32 comid = 0; String loc = ""; GMap.NET.WindowsForms.GMapOverlay markers1 = new GMap.NET.WindowsForms.GMapOverlay("markers1"); foreach (DataGridViewRow drrow in dataGridView1.Rows) { Double.TryParse(drrow.Cells["Longitude"].Value.ToString(), out lo); Double.TryParse(drrow.Cells["Latitude"].Value.ToString(), out la); Int32.TryParse(drrow.Cells["Company_id"].Value.ToString(), out comid); if (comid > 19) { comid = 1; } else { comid--; } if (comid < 0) { comid = 0; } ; loc = drrow.Cells["Latitude"].Value.ToString() + " , " + drrow.Cells["Longitude"].Value.ToString(); GMap.NET.WindowsForms.GMapMarker marker1 = ( new GMap.NET.WindowsForms.Markers.GMarkerGoogle( new GMap.NET.PointLatLng(la, lo), BitList[comid])); //new Bitmap("ico\\3-min.png"))); //GMap.NET.WindowsForms.Markers.GMarkerGoogleType.blue_pushpin)); marker1.Tag = drrow.Cells["Address"].Value.ToString() + "+-+" + drrow.Cells["id"].Value.ToString(); marker1.Tag = drrow.Cells["id"].Value.ToString(); markers1.Markers.Add(marker1); } /// markers.Markers.Add(marker); //GMap.NET.WindowsForms.GMapMarker Cent = MarkerInInitialPos(); markers1.Markers.Add(MarkerInInitialPos()); gMap.Overlays.Add(markers1); if (loc.Trim() == "") { loc = GlobLat.ToString() + " , " + GlobLon.ToString(); gMap.SetPositionByKeywords(loc); gMap.ZoomAndCenterMarkers(loc); gMap.Position = new GMap.NET.PointLatLng(GlobLat, GlobLon); } else { gMap.SetPositionByKeywords(loc); gMap.ZoomAndCenterMarkers(loc); gMap.Position = new GMap.NET.PointLatLng(la, lo); } }
private void GMapControl1_OnMarkerDoubleClick(GMap.NET.WindowsForms.GMapMarker item, MouseEventArgs e) { find = load + item.Position.Lat.ToString() + "," + item.Position.Lng.ToString(); gMapControl1.Enabled = false; webBrowser1.BringToFront(); webBrowser1.Navigate(find); // chromiumWebBrowser1.Load(find); button1.Visible = true; richTextBox1.Text = "Predicted:\n" + "Under Bridge"; richTextBox1.Update(); }
private void gMap_OnMarkerClick(GMap.NET.WindowsForms.GMapMarker item, MouseEventArgs e) { string words = item.Tag.ToString(); if (words == "0") { return; } else { gMap_StationDetail(item.Tag.ToString()); } }
public void gMapControl1_OnMarkerClick(GMap.NET.WindowsForms.GMapMarker item, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { if (item.Tag == null) { Personnel p = (from x in MainForm.staff where x.Coord == item select x).First(); curPersonnel = p; } else { return; } } }
private void gMapControl1_OnMarkerClick(GMap.NET.WindowsForms.GMapMarker item, MouseEventArgs e) { if (gMapControl1.Overlays.Count > 0) { foreach (GMap.NET.WindowsForms.GMapMarker m in gMapControl1.Overlays[0].Markers) { if (item.ToolTipText == m.ToolTipText) { MessageBox.Show(gMapControl1.Overlays[0].Markers.IndexOf(m).ToString()); } } } //.GMarkerGoogle marker1 = item.Overlay.Markers[] //item.Overlay.Markers.Remove( // }
private void gMap_OnMarkerLeave(GMap.NET.WindowsForms.GMapMarker item) { this.label1.Text = ""; }
private void gMap_OnMarkerEnter(GMap.NET.WindowsForms.GMapMarker item) { this.label1.Text = item.Tag.ToString(); }
/** * Map marker click **/ private void gMap_OnMarkerClick(GMap.NET.WindowsForms.GMapMarker item, MouseEventArgs e) { pictureBoxMap.Image = Image.FromFile(@"C:\Users\minuf\Documents\Visual Studio 2013\Projects\NeighborhoodInformant\NeighborhoodInformant\bin\Debug\homeforsale.jpg"); LogicTier.Listing listing = database.getListingFromAddress(item.ToolTipText); currListing = listing; listBoxMapDetails.Items.Clear(); listBoxMapDetails.Items.Add(listing.fullAddress()); listBoxMapDetails.Items.Add("Size: " + listing.SqFeet + " square feet"); listBoxMapDetails.Items.Add("Type: " + listing.Type); listBoxMapDetails.Items.Add("Bedrooms: " + listing.NoBed); listBoxMapDetails.Items.Add("Bathrooms: " + listing.NoBath); decimal price = decimal.Parse(listing.Price.ToString()); string priceStr = String.Format("Price: {0:C2}", price); listBoxMapDetails.Items.Add(priceStr); if (!string.IsNullOrEmpty(listing.Picture)) { pictureBoxMap.Image = new Bitmap(listing.Picture); } buttonMapMessage.Enabled = true; details = listing.StAddr.ToString() + "," + listing.ZipCode.ToString() + "," + listing.Type.ToString() + "," + listing.SqFeet.ToString() + "," + listing.NoBed.ToString() + "," + listing.NoBath.ToString() + "," + listing.Price.ToString() + "\n"; buttonMapExport.Enabled = true; if (currUser != null) { int c = 0; listBoxMapDetails.Items.Add("Schools: "); IReadOnlyList <String> schools = database.getSchools(listing.ZipCode); foreach (var school in schools) { c++; listBoxMapDetails.Items.Add(" " + school); } if (c == 0) { listBoxMapDetails.Items.Add(" None"); } c = 0; listBoxMapDetails.Items.Add("Hospitals: "); IReadOnlyList <String> hospitals = database.getHospitals(listing.ZipCode); foreach (var hospital in hospitals) { c++; listBoxMapDetails.Items.Add(" " + hospital); } if (c == 0) { listBoxMapDetails.Items.Add(" None"); } listBoxMapDetails.Items.Add("Police Stations: "); c = 0; IReadOnlyList <String> stations = database.getPoliceStations(listing.ZipCode); foreach (var station in stations) { c++; listBoxMapDetails.Items.Add(" " + station); } if (c == 0) { listBoxMapDetails.Items.Add(" None"); } listBoxMapDetails.Items.Add("Crime Rate:"); listBoxMapDetails.Items.Add(" " + String.Format("{0:0.##}", database.getCrimeRate(listing.ZipCode))); } }
// WHERE VehicleID = 1" private void button1_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(); con.ConnectionString = ("Server=" + servername + ";Database=Vehicle_loc1;" + "Trusted_Connection=True;"); con.Open(); SqlCommand Getvehiclename = new SqlCommand("SELECT * FROM Coordinates", con); SqlDataReader coReader = Getvehiclename.ExecuteReader(); coReader.Read(); label3.Text = coReader["VehicleName"].ToString(); textBox3.Text = coReader["Latitude"].ToString(); textBox4.Text = coReader["Longitude"].ToString(); if (check) { markers.Markers.Remove(marker1); } marker1 = new GMap.NET.WindowsForms.Markers.GMarkerGoogle( new GMap.NET.PointLatLng(Convert.ToDouble(coReader["Latitude"]), Convert.ToDouble(coReader["Longitude"])), GMap.NET.WindowsForms.Markers.GMarkerGoogleType.red_dot); markers.Markers.Add(marker1); coReader.Read(); label4.Text = coReader["VehicleName"].ToString(); textBox5.Text = coReader["Latitude"].ToString(); textBox6.Text = coReader["Longitude"].ToString(); if (check) { markers.Markers.Remove(marker2); } marker2 = new GMap.NET.WindowsForms.Markers.GMarkerGoogle( new GMap.NET.PointLatLng(Convert.ToDouble(coReader["Latitude"]), Convert.ToDouble(coReader["Longitude"])), GMap.NET.WindowsForms.Markers.GMarkerGoogleType.yellow_dot); markers.Markers.Add(marker2); coReader.Read(); label5.Text = coReader["VehicleName"].ToString(); textBox7.Text = coReader["Latitude"].ToString(); textBox8.Text = coReader["Longitude"].ToString(); if (check) { markers.Markers.Remove(marker3); } marker3 = new GMap.NET.WindowsForms.Markers.GMarkerGoogle( new GMap.NET.PointLatLng(Convert.ToDouble(coReader["Latitude"]), Convert.ToDouble(coReader["Longitude"])), GMap.NET.WindowsForms.Markers.GMarkerGoogleType.green_dot); markers.Markers.Add(marker3); coReader.Read(); label6.Text = coReader["VehicleName"].ToString(); textBox9.Text = coReader["Latitude"].ToString(); textBox10.Text = coReader["Longitude"].ToString(); if (check) { markers.Markers.Remove(marker4); } marker4 = new GMap.NET.WindowsForms.Markers.GMarkerGoogle( new GMap.NET.PointLatLng(Convert.ToDouble(coReader["Latitude"]), Convert.ToDouble(coReader["Longitude"])), GMap.NET.WindowsForms.Markers.GMarkerGoogleType.blue_dot); markers.Markers.Add(marker4); coReader.Read(); label7.Text = coReader["VehicleName"].ToString(); textBox11.Text = coReader["Latitude"].ToString(); textBox12.Text = coReader["Longitude"].ToString(); if (check) { markers.Markers.Remove(marker5); } check = true; marker5 = new GMap.NET.WindowsForms.Markers.GMarkerGoogle( new GMap.NET.PointLatLng(Convert.ToDouble(coReader["Latitude"]), Convert.ToDouble(coReader["Longitude"])), GMap.NET.WindowsForms.Markers.GMarkerGoogleType.purple_dot); markers.Markers.Add(marker5); if (check) { gMapControl1.Overlays.Remove(markers); gMapControl1.Overlays.Add(markers); } else { gMapControl1.Overlays.Remove(markers); } con.Close(); }
private void gMapControl1_OnMouseMove(GMap.NET.WindowsForms.GMapMarker item, System.Windows.Forms.MouseEventArgs e) { }
private void map_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { // textBox1.Text = "UwU"; if (held1) { markers.Markers.Remove(marker1); marker1 = new GMap.NET.WindowsForms.Markers.GMarkerGoogle( new GMap.NET.PointLatLng(Math.Round(gMapControl1.FromLocalToLatLng(e.X, e.Y).Lat, 6), Math.Round(gMapControl1.FromLocalToLatLng(e.X, e.Y).Lng, 6)), GMap.NET.WindowsForms.Markers.GMarkerGoogleType.red_dot); markers.Markers.Add(marker1); textBox3.Text = Math.Round(gMapControl1.FromLocalToLatLng(e.X, e.Y).Lat, 6).ToString(); textBox4.Text = Math.Round(gMapControl1.FromLocalToLatLng(e.X, e.Y).Lng, 6).ToString(); held1 = false; } if (held2) { markers.Markers.Remove(marker2); marker2 = new GMap.NET.WindowsForms.Markers.GMarkerGoogle( new GMap.NET.PointLatLng(Math.Round(gMapControl1.FromLocalToLatLng(e.X, e.Y).Lat, 6), Math.Round(gMapControl1.FromLocalToLatLng(e.X, e.Y).Lng, 6)), GMap.NET.WindowsForms.Markers.GMarkerGoogleType.yellow_dot); markers.Markers.Add(marker2); textBox5.Text = Math.Round(gMapControl1.FromLocalToLatLng(e.X, e.Y).Lat, 6).ToString(); textBox6.Text = Math.Round(gMapControl1.FromLocalToLatLng(e.X, e.Y).Lng, 6).ToString(); held2 = false; } if (held3) { markers.Markers.Remove(marker3); marker3 = new GMap.NET.WindowsForms.Markers.GMarkerGoogle( new GMap.NET.PointLatLng(Math.Round(gMapControl1.FromLocalToLatLng(e.X, e.Y).Lat, 6), Math.Round(gMapControl1.FromLocalToLatLng(e.X, e.Y).Lng, 6)), GMap.NET.WindowsForms.Markers.GMarkerGoogleType.green_dot); markers.Markers.Add(marker3); textBox7.Text = Math.Round(gMapControl1.FromLocalToLatLng(e.X, e.Y).Lat, 6).ToString(); textBox8.Text = Math.Round(gMapControl1.FromLocalToLatLng(e.X, e.Y).Lng, 6).ToString(); held3 = false; } if (held4) { markers.Markers.Remove(marker4); marker4 = new GMap.NET.WindowsForms.Markers.GMarkerGoogle( new GMap.NET.PointLatLng(Math.Round(gMapControl1.FromLocalToLatLng(e.X, e.Y).Lat, 6), Math.Round(gMapControl1.FromLocalToLatLng(e.X, e.Y).Lng, 6)), GMap.NET.WindowsForms.Markers.GMarkerGoogleType.blue_dot); markers.Markers.Add(marker4); textBox9.Text = Math.Round(gMapControl1.FromLocalToLatLng(e.X, e.Y).Lat, 6).ToString(); textBox10.Text = Math.Round(gMapControl1.FromLocalToLatLng(e.X, e.Y).Lng, 6).ToString(); held4 = false; } if (held5) { markers.Markers.Remove(marker5); marker5 = new GMap.NET.WindowsForms.Markers.GMarkerGoogle( new GMap.NET.PointLatLng(Math.Round(gMapControl1.FromLocalToLatLng(e.X, e.Y).Lat, 6), Math.Round(gMapControl1.FromLocalToLatLng(e.X, e.Y).Lng, 6)), GMap.NET.WindowsForms.Markers.GMarkerGoogleType.purple_dot); markers.Markers.Add(marker5); textBox11.Text = Math.Round(gMapControl1.FromLocalToLatLng(e.X, e.Y).Lat, 6).ToString(); textBox12.Text = Math.Round(gMapControl1.FromLocalToLatLng(e.X, e.Y).Lng, 6).ToString(); held5 = false; } }
private void gMap_OnMarkerClick(GMap.NET.WindowsForms.GMapMarker item, MouseEventArgs e) { Console.WriteLine(String.Format("Marker {0} was clicked.", item.Tag)); MessageBox.Show("Help"); }
private void gMapControl1_Load(object sender, EventArgs e) { using (TextReader reader = File.OpenText("mapposition.config")) { X0 = Convert.ToDouble(reader.ReadLine()); Y0 = Convert.ToDouble(reader.ReadLine()); reader.Close(); } gMapControl1.MapProvider = GMap.NET.MapProviders.GoogleHybridMapProvider.Instance; GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly; gMapControl1.Position = new GMap.NET.PointLatLng(X0, Y0); textBox1.Text = X0.ToString(); textBox2.Text = Y0.ToString(); this.gMapControl1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.map_MouseDown); this.gMapControl1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.map_MouseUp); SqlConnection con = new SqlConnection(); using (TextReader reader = File.OpenText("servername.config")) { servername = (reader.ReadLine()); reader.Close(); } con.ConnectionString = ("Server=" + servername + ";Database=Vehicle_loc1;" + "Trusted_Connection=True;"); con.Open(); SqlCommand Getvehiclename = new SqlCommand("SELECT * FROM Coordinates", con); SqlDataReader coReader = Getvehiclename.ExecuteReader(); coReader.Read(); label3.Text = coReader["VehicleName"].ToString(); textBox3.Text = coReader["Latitude"].ToString(); textBox4.Text = coReader["Longitude"].ToString(); if (check) { markers.Markers.Remove(marker1); } marker1 = new GMap.NET.WindowsForms.Markers.GMarkerGoogle( new GMap.NET.PointLatLng(Convert.ToDouble(coReader["Latitude"]), Convert.ToDouble(coReader["Longitude"])), GMap.NET.WindowsForms.Markers.GMarkerGoogleType.red_dot); markers.Markers.Add(marker1); coReader.Read(); label4.Text = coReader["VehicleName"].ToString(); textBox5.Text = coReader["Latitude"].ToString(); textBox6.Text = coReader["Longitude"].ToString(); if (check) { markers.Markers.Remove(marker2); } marker2 = new GMap.NET.WindowsForms.Markers.GMarkerGoogle( new GMap.NET.PointLatLng(Convert.ToDouble(coReader["Latitude"]), Convert.ToDouble(coReader["Longitude"])), GMap.NET.WindowsForms.Markers.GMarkerGoogleType.yellow_dot); markers.Markers.Add(marker2); coReader.Read(); label5.Text = coReader["VehicleName"].ToString(); textBox7.Text = coReader["Latitude"].ToString(); textBox8.Text = coReader["Longitude"].ToString(); if (check) { markers.Markers.Remove(marker3); } marker3 = new GMap.NET.WindowsForms.Markers.GMarkerGoogle( new GMap.NET.PointLatLng(Convert.ToDouble(coReader["Latitude"]), Convert.ToDouble(coReader["Longitude"])), GMap.NET.WindowsForms.Markers.GMarkerGoogleType.green_dot); markers.Markers.Add(marker3); coReader.Read(); label6.Text = coReader["VehicleName"].ToString(); textBox9.Text = coReader["Latitude"].ToString(); textBox10.Text = coReader["Longitude"].ToString(); if (check) { markers.Markers.Remove(marker4); } marker4 = new GMap.NET.WindowsForms.Markers.GMarkerGoogle( new GMap.NET.PointLatLng(Convert.ToDouble(coReader["Latitude"]), Convert.ToDouble(coReader["Longitude"])), GMap.NET.WindowsForms.Markers.GMarkerGoogleType.blue_dot); markers.Markers.Add(marker4); coReader.Read(); label7.Text = coReader["VehicleName"].ToString(); textBox11.Text = coReader["Latitude"].ToString(); textBox12.Text = coReader["Longitude"].ToString(); if (check) { markers.Markers.Remove(marker5); } check = true; marker5 = new GMap.NET.WindowsForms.Markers.GMarkerGoogle( new GMap.NET.PointLatLng(Convert.ToDouble(coReader["Latitude"]), Convert.ToDouble(coReader["Longitude"])), GMap.NET.WindowsForms.Markers.GMarkerGoogleType.purple_dot); markers.Markers.Add(marker5); if (check) { gMapControl1.Overlays.Remove(markers); gMapControl1.Overlays.Add(markers); } else { gMapControl1.Overlays.Remove(markers); } con.Close(); }