private void button1_Click(object sender, EventArgs e) //放大 { MapView.enlarge2(); if (showMRT == true) { MrtLayer.drawLine(); } if (MapView.testFlag == true) { TownLayer.drawPolygon(); } if (MapView.iconFlag == true) { LandmarkLayer land = new LandmarkLayer(); land.drawIcon(MapView.mapX * 256 + 1365, MapView.mapX * 256, MapView.mapY * 256 + 1365, MapView.mapY * 256, out MapView.ltox, out MapView.ltoy, out MapView.cate); } this.Text = "X: " + MapView.mapX + " " + " Y: " + MapView.mapY + " lavel: " + MapView.level; if (MapView.iconFlag == true) { test.drawIcon(MapView.mapX * 256 + 1365, MapView.mapX * 256, MapView.mapY * 256 + 1365, MapView.mapY * 256, out MapView.ltox, out MapView.ltoy, out MapView.cate); } if (MapView.locateFlag == true) { locateXY(); } mapView1.Invalidate(); }
private void richTextBox_MouseUp(object sender, MouseEventArgs e) { isDragging = false; Xaxis = (Xaxis - e.X) / 256; Yaxis = (Yaxis - e.Y) / 256; if (MapView.level >= 2 && selectionFlag == false) { 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 + Xaxis, i + Yaxis, MapView.level)); MapView.m_Images.Add(Image.FromStream(new MemoryStream(wc.DownloadData("https://ecn.t1.tiles.virtualearth.net/tiles/" + MapView.layer + MapView.s[cnt] + ".jpeg?g=3649")))); cnt++; } } MapView.total = MapView.range * MapView.range; MapView.mapX += Xaxis; MapView.mapY += Yaxis; } if (selectionFlag == true) { middlex = e.X - mouseRect.Width / 2; middley = e.Y - mouseRect.Height / 2; //MessageBox.Show(middlex + " " + middley); MapView.partial(middlex, middley); Cursor.Clip = Rectangle.Empty; DrawRectangle(); mouseRect = Rectangle.Empty; selectionFlag = false; mapView1.Cursor = Cursors.Default; } if (MapView.testFlag == true) { TownLayer.drawPolygon(); } if (MapView.iconFlag == true) { test.drawIcon(MapView.mapX * 256 + 1024, MapView.mapX * 256, MapView.mapY * 256 + 1024, MapView.mapY * 256, out MapView.ltox, out MapView.ltoy, out MapView.cate); } if (MapView.locateFlag == true) { locateXY(); } mapView1.Invalidate(); }
private void button8_Click(object sender, EventArgs e) //全圖 { MapView.allView(); if (MapView.testFlag == true) { TownLayer.drawPolygon(); } if (MapView.iconFlag == true) { LandmarkLayer land = new LandmarkLayer(); land.drawIcon(MapView.mapX * 256 + 1365, MapView.mapX * 256, MapView.mapY * 256 + 1365, MapView.mapY * 256, out MapView.ltox, out MapView.ltoy, out MapView.cate); } this.Text = "X: " + MapView.mapX + " " + " Y: " + MapView.mapY + " lavel: " + MapView.level; if (MapView.iconFlag == true) { test.drawIcon(MapView.mapX * 256 + 1365, MapView.mapX * 256, MapView.mapY * 256 + 1365, MapView.mapY * 256, out MapView.ltox, out MapView.ltoy, out MapView.cate); } this.Refresh(); }
private void button2_Click(object sender, EventArgs e) // 縮小 { MapView.reduce(); if (showMRT == true) { MrtLayer.drawLine(); } if (MapView.testFlag == true) { TownLayer.drawPolygon(); } this.Text = "X: " + MapView.mapX + " " + " Y: " + MapView.mapY + " leval: " + MapView.level; if (MapView.iconFlag == true) { test.drawIcon(MapView.mapX * 256 + 1365, MapView.mapX * 256, MapView.mapY * 256 + 1365, MapView.mapY * 256, out MapView.ltox, out MapView.ltoy, out MapView.cate); } if (MapView.locateFlag == true) { locateXY(); } mapView1.Invalidate(); }
private void button1_Click(object sender, EventArgs e) { if (conection.identify(textBox1.Text, textBox2.Text)) { MessageBox.Show("登入成功", "登入系統"); Form1.UserAccount = textBox1.Text; int[] query = new int [6]; char layer = ' '; conection.userLogin(out query, out flag, out layer, Form1.UserAccount); if (query[0] != 1000) { MapView.loginMap(query[0], query[1], query[2], query[3], query[4], query[5], flag[0], flag[1], flag[2], layer); } if (flag[0] == true) { MrtLayer.drawLine(); Form1.showMRT = true; } if (flag[1] == true) { TownLayer.drawPolygon(); MapView.testFlag = true; } if (flag[2] == true) { LandmarkLayer test = new LandmarkLayer(); test.drawIcon(MapView.mapX * 256 + 1024, MapView.mapX * 256, MapView.mapY * 256 + 1024, MapView.mapY * 256, out MapView.ltox, out MapView.ltoy, out MapView.cate); MapView.iconFlag = true; } LAY = layer; textBox1.Text = ""; textBox2.Text = ""; this.Visible = false; Form1.paintFlag = true; this.Parent.Invalidate(); } else { MessageBox.Show("帳號或密碼有誤!!", "輸入錯誤"); } }
private void treeView1_AfterCheck(object sender, TreeViewEventArgs e) { if (treeView1.Nodes[0].Checked == true) { foreach (TreeNode ChildeNode in e.Node.Nodes) { ChildeNode.Checked = true; } } else { foreach (TreeNode ChildeNode in e.Node.Nodes) { ChildeNode.Checked = false; } } if (treeView1.Nodes[0].Nodes[0].Checked == true) { MapView.MRTFocus(); if (showMRT == false) { MrtLayer.drawLine(); showMRT = true; } } else { showMRT = false; } if (treeView1.Nodes[0].Nodes[1].Checked == true) { if (MapView.testFlag == false) { TownLayer.drawPolygon(); MapView.testFlag = true; } } else { MapView.testFlag = false; } if (treeView1.Nodes[0].Nodes[2].Checked == true) { if (MapView.iconFlag == false) { MapView.iconFlag = true; } LandmarkLayer test = new LandmarkLayer(); test.drawIcon(MapView.mapX * 256 + 1024, MapView.mapX * 256, MapView.mapY * 256 + 1024, MapView.mapY * 256, out MapView.ltox, out MapView.ltoy, out MapView.cate); } else { MapView.iconFlag = false; } if (e.Node == treeView1.Nodes[1].Nodes[0]) { if (treeView1.Nodes[1].Nodes[0].Checked == true) { MapView.layer = 'a'; treeView1.Nodes[1].Nodes[1].Checked = false; treeView1.Nodes[1].Nodes[2].Checked = false; } } if (e.Node == treeView1.Nodes[1].Nodes[1]) { if (treeView1.Nodes[1].Nodes[1].Checked == true) { MapView.layer = 'r'; treeView1.Nodes[1].Nodes[0].Checked = false; treeView1.Nodes[1].Nodes[2].Checked = false; } } if (e.Node == treeView1.Nodes[1].Nodes[2]) { if (treeView1.Nodes[1].Nodes[2].Checked == true) { MapView.layer = 'h'; treeView1.Nodes[1].Nodes[0].Checked = false; treeView1.Nodes[1].Nodes[1].Checked = false; } } WebClient wc = new WebClient(); MapView.m_Images.Clear(); if (MapView.level == 1) { MapView.range = 2; } for (int i = 0; i < MapView.range * MapView.range; i++) { MapView.m_Images.Add(Image.FromStream(new MemoryStream(wc.DownloadData("https://ecn.t1.tiles.virtualearth.net/tiles/" + MapView.layer + MapView.s[i] + ".jpeg?g=3649")))); } this.Refresh(); }