public void loadLand() { List <string> array = new List <string>(); List <string> array2 = new List <string>(); conection enter = new conection(); readFile("C:/Users/user/Desktop/2018_工程師須看的書/2.C#BingMapViewer/題目/Khsc_landmark.csv", out array); readFile("C:/Users/user/Desktop/2018_工程師須看的書/2.C#BingMapViewer/題目/Khsc_landmark.geo", out array2); for (int i = 0; i < 4061; i++) { string[] words = array[i].Split(','); string[] words2 = array2[i].Split(','); string catagory = ""; if (words[3].IndexOf("國小") != -1 || words[3].IndexOf("國中") != -1 || words[3].IndexOf("高中") != -1) { catagory = "school"; } if (words[3].IndexOf("加油站") != -1) { catagory = "gas"; } if (words[3].IndexOf("捷運站") != -1) { catagory = "mrt"; } if (words[3].IndexOf("停車場") != -1) { catagory = "parking"; } if (catagory != "") { enter.insertLand(words[0], words[3], words[5], words[6], words2[1], words2[2], catagory); } } }
private void locateXY() { conection con = new conection(); con.findLocation(textBox1.Text, out returnx, out returny, false); MapView.locateX = returnx - MapView.mapX * 256 - 7; MapView.locateY = returny - MapView.mapY * 256 - 63; }
public void drawIcon(int topx, int btnx, int topy, int btny, out List <int> lati, out List <int> longi, out List <string> cate) { double lat, lon, lat2, lon2; conection con = new conection(); BingMaps.PixelXYToLatLong(topx, topy, MapView.level, out lat, out lon); BingMaps.PixelXYToLatLong(btnx, btny, MapView.level, out lat2, out lon2); con.isExist(lat, lon, lat2, lon2, out lati, out longi, out cate); }
private void richTextBox_MouseMove(object sender, MouseEventArgs e) { if (isDragging) { if (selectionFlag == true) { ResizeToRectangle(e.Location); } if (MapView.level < 2 && selectionFlag == false) { mapView1.Left += (e.X - px); mapView1.Top += (e.Y - py); disx += (e.X - px); disy += (e.Y - py); } if (MapView.level > 100) { if ((e.X - Xaxis) <= -5) { // Xaxis = 1; WebClient wc = new WebClient(); MapView.m_Images.Clear(); MapView.s.Clear(); int cnt = 0; for (int i = MapView.mapY; i < MapView.range + MapView.mapY; i++) { for (int j = MapView.mapX; j < MapView.range + MapView.mapX; j++) { MapView.s.Add(BingMaps.TileXYToQuadKey(j - 2, i, MapView.level)); MapView.m_Images.Add(Image.FromStream(new MemoryStream(wc.DownloadData("https://ecn.t1.tiles.virtualearth.net/tiles/a" + MapView.s[cnt] + ".jpeg?g=3649")))); cnt++; } } //MessageBox.Show((e.X - Xaxis)+"\n"+e.X+"\n"+Xaxis); } } px = e.X; py = e.Y; release = 1; this.Refresh(); } toolTip1.ToolTipIcon = ToolTipIcon.Info; toolTip1.ForeColor = Color.Blue; toolTip1.BackColor = Color.Gray; for (int i = 0; i < MapView.ltox.Count; i++) { if (e.X >= MapView.ltox[i] - 20 && e.X <= MapView.ltox[i] + 20 && e.Y <= MapView.ltoy[i] + 20 && e.Y >= MapView.ltoy[i] - 20 && MapView.iconFlag == true) { conection con = new conection(); string s = "", tile = ""; con.returnInfo(MapView.ltox[i], MapView.ltoy[i], out s, out tile); toolTip1.ToolTipTitle = tile; //Thread.Sleep(500); toolTip1.Show(s, this, new Point(MapView.ltox[i], MapView.ltoy[i])); break; } else { toolTip1.RemoveAll(); } } BingMaps.PixelXYToLatLong(e.X + MapView.mapX * 256, e.Y + MapView.mapY * 256, MapView.level, out lalitude, out longitude); this.Text = "lalitude: " + lalitude + " longitude: " + longitude + " X: " + e.X + " Y: " + e.Y + " MapX: " + MapView.mapX + " MapY: " + MapView.mapY; }