void GerarMarkers() { markersOverlay.Clear(); for (int i = 0; i < pontos.Count; i++) { //Dependendo da intensidade mudar a cor do marker GMarkerGoogleType markerColor = GMarkerGoogleType.red; if (pontos[i].intensidade >= -70) { markerColor = GMarkerGoogleType.green; } if (pontos[i].intensidade < -70 && pontos[i].intensidade >= -110) { markerColor = GMarkerGoogleType.yellow; } if (pontos[i].intensidade < -110) { markerColor = GMarkerGoogleType.red; } //Inserir um label para cada ponto com a intensidade marker[i] = new GMarkerGoogle(new PointLatLng(pontos[i].lat, pontos[i].lng), markerColor); marker[i].ToolTip = new GMapToolTip(marker[i]); marker[i].ToolTipText = String.Format("Int: {0}\nDist: {1}\nLat: {2}\nLng: {3}", pontos[i].intensidade, distance(pontos[i].lat, pontos[i].lng, -21.7270, -55.4018, 'K').ToString("n3"), pontos[i].lat, pontos[i].lng); markersOverlay.Markers.Add(marker[i]); } gmap.Overlays.Add(markersOverlay); }
private void BtnConfirmNewBorderOnClicked(object sender, EventArgs e) { if (MessageDialogHelper.RunQuestionDialog("Завершить создание границы района?")) { if (ViewModel.NewBorderVertices.Count < 3) { MessageDialogHelper.RunInfoDialog("Нельзя создать границу района меньше чем за 3 точки"); return; } toggleNewBorderPreview.Active = false; newBordersPreviewOverlay.Clear(); ViewModel.ConfirmNewBorderCommand.Execute(); RefreshBorders(); } }
private void closesafearea_Click(object sender, EventArgs e) { if (btnsafelocation == true) { safelocations.Clear(); safelocationoverlay.Clear(); map.Refresh(); closeholder.Visible = false; btnsafelocation = false; } if (btnaffetectedarea == true) { if ((lowerleveloverlay != null) || (mediumleveloverlay != null) || (highleveloverlay != null)) { lowerleveloverlay.Polygons.Clear(); lowerleveloverlay.Clear(); mediumleveloverlay.Polygons.Clear(); mediumleveloverlay.Clear(); highleveloverlay.Polygons.Clear(); highleveloverlay.Clear(); map.Zoom = map.Zoom + 1; map.Zoom = map.Zoom - 1; } cardthreatlevel.Visible = false; } }
private void btnCompute2_Click(object sender, EventArgs e) { try { DijkstraFinding dijkstra = new DijkstraFinding(BusManager.Inst()); string[] listRouter = tbRouters.Text.Split(','); for (int i = 0; i < listRouter.Length; i++) { string[] parts = listRouter[i].Split('_'); int routerId = Int32.Parse(parts[0]); int turn = Int32.Parse(parts[1]); dijkstra.addRouterAtStation(routerId, Routers[routerId].getStations(turn)[0], turn); } Vertex dest = dijkstra.computePath(_startStation, _endStation); if (dest == null || dest.PreviewVertex == null) { MessageBox.Show("Cannot find shortest path"); return; } List <int> pathStation = dijkstra.convertPathToStations(dest); //clearMap(); sortedPathOverlay.Clear(); drawStationPath(pathStation, Color.Red, sortedPathOverlay); } catch { MessageBox.Show("Invalid routers. Try again!"); } }
private void button2_Click(object sender, EventArgs e) { isDistince = false; distincePairs.Clear(); distinceOverlay.Clear(); this.gMapControl1.Overlays.Remove(distinceOverlay); }
void RefreshMap(GMapControl control, string stroke, int count) { polyOverlay.Clear(); listPolygonGlobal = Distributor(stroke, count); List <PointLatLng> points = new List <PointLatLng>(); foreach (var polygon in listPolygonGlobal) { poly++; foreach (var point in polygon) { dots++; points.Add(new PointLatLng(point[1], point[0])); } GMapPolygon polygonGMap = new GMapPolygon(points, "some"); polygonGMap.Fill = new SolidBrush(Color.FromArgb(50, Color.Red)); polygonGMap.Stroke = new Pen(Color.Red, 1); points = new List <PointLatLng>(); polyOverlay.Polygons.Add(polygonGMap); } gMapControl.Overlays.Add(polyOverlay); gMapControl.Zoom -= 1; gMapControl.Zoom += 1; rTextBox.Text = $"Полигонов: {poly}, Всего точек: {dots}."; poly = 0; dots = 0; }
private void OnTimedEvent(Object source, System.Timers.ElapsedEventArgs e) { if (routes.Routes.Count > 0) { routes?.Routes.RemoveAt(0); } else if (routes.Routes.Count <= 0) { deletingTimer.Stop(); } if (routes.Routes.Count < 1) { addingTimer.Start(); } if (markers.Markers.Count > 1) { markers.Markers.RemoveAt(0); if (routes.Routes.Count < 1) { markers.Markers.Clear(); } } else { markers.Clear(); } deletingTimer.Interval = 2000 * routes.Routes.ElementAt(0).Distance; }
void FillDialogAtDay() { addressesOverlay.Clear(); TurnOffCheckShowOnlyDriverOrders(); logger.Info("Загружаем заказы на {0:d}...", ViewModel.DateForRouting); ViewModel.InitializeData(); UpdateRoutesPixBuf(); UpdateRoutesButton(); UpdateAddressesOnMap(); var levels = LevelConfigFactory.FirstLevel <RouteList, RouteListItem>(x => x.Addresses).LastLevel(c => c.RouteList).EndConfig(); ytreeRoutes.YTreeModel = new LevelTreeModel <RouteList>(ViewModel.RoutesOnDay, levels); }
private void OnMap_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { var x = _mapControl.FromLocalToLatLng(e.X, e.Y).Lat; var y = _mapControl.FromLocalToLatLng(e.X, e.Y).Lng; _closerDepartmentOverlay.Clear(); _userPositionOverlay.Markers.Clear(); GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(x, y), GMarkerGoogleType.red); marker.ToolTip = new GMapRoundedToolTip(marker); marker.ToolTipText = "Ваше местоположение"; _userPositionOverlay.Markers.Add(marker); } }
private void gmapOnTimedEvent(object source, ElapsedEventArgs e) { BeginInvoke((MethodInvoker) delegate { try { //gMapControl1.Position = new PointLatLng(lat, lon); //GMapMarker marker = new GMarkerGoogle(p, GMarkerGoogleType.arrow); GMapMarker[] marker = new GMapMarker[_mavLink.node_gps.Count]; realRouteOverlay.Clear(); for (int i = 0; i < _mavLink.node_gps.Count; i++) { //PointLatLng p = this.gMapControl1.FromLocalToLatLng(e.X, e.Y);//将鼠标点击点坐标转换为经纬度坐标 //GMapMarker marker = new GMarkerGoogle(p, GMarkerGoogleType.arrow); marker[i] = new GMarkerGoogle(new PointLatLng(_mavLink.node_gps[i].lat, _mavLink.node_gps[i].lon), GMarkerGoogleType.green_small); marker[i].ToolTipText = "Node: " + _mavLink.node_gps[i].node[0].ToString() + _mavLink.node_gps[i].node[1].ToString(); realRouteOverlay.Markers.Add(marker[i]);//Add a new anchor point gMapControl1.Overlays.Add(realRouteOverlay); } } catch { } }); }
private void deletePoints_click(object sender, EventArgs e) //Limpia todas las capas { puntos.Clear(); markers.Clear(); polygons.Clear(); routes.Clear(); }
/// <summary> /// 释放命令 /// </summary> public void ReleaseCommond() { if (gmapControl == null) { return; } if (gmapControl.Overlays.Contains(overlay)) { overlay.Clear(); gmapControl.Overlays.Remove(overlay); } gmapControl.OnPolygonEnter -= gmapControl_OnPolygonEnter; gmapControl.OnPolygonLeave -= gmapControl_OnPolygonLeave; gmapControl.OnMarkerEnter -= gmapControl_OnMarkerEnter; gmapControl.OnMarkerLeave -= gmapControl_OnMarkerLeave; gmapControl.MouseMove -= gmapControl_MouseMove; gmapControl.MouseUp -= gmapControl_MouseUp; gmapControl.MouseDown -= gmapControl_MouseDown; gmapControl.DoubleClick -= gmapControl_DoubleClick; gmapControl.MouseMove -= gmapControl_MouseMovePoint; gmapControl.MouseUp -= gmapControl_MouseUpPoint; gmapControl.MouseDown -= gmapControl_MouseDownPoint; gmapControl.KeyDown -= gmapControl_KeyDown; Utils.bPublishEvent = true; }
private static void PointsLoad(GMapControl map) { string id; double x, y; pointsOverlay.Clear(); GMarkerGoogle marker; marker = new GMarkerGoogle(new PointLatLng(xist, yist), GMarkerGoogleType.red_small); marker.ToolTip = new GMapRoundedToolTip(marker); marker.ToolTipText = "ТЭЦ-5"; pointsOverlay.Markers.Add(marker); SqlCommand command = new SqlCommand("Select * FROM Points", connection); connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { x = (double)reader["lat"]; y = (double)reader["lng"]; id = reader["Id"].ToString(); marker = new GMarkerGoogle(new PointLatLng(x, y), GMarkerGoogleType.black_small); marker.ToolTip = new GMapToolTip(marker); marker.ToolTipText = id; pointsOverlay.Markers.Add(marker); } connection.Close(); map.Overlays.Add(pointsOverlay); }
private void clearMap() { _drawedStation.Clear(); markersOverlay.Clear(); routerOverlay.Clear(); currentMarker = null; }
private void clearMap() { points.Clear(); Routes.Clear(); Objects.Clear(); clearFields(); }
public void LimpiarMapaTerreno() { gMapControl1.Overlays.RemoveAt(1); PoligonoTerreno.Clear(); gMapControl1.Zoom = gMapControl1.Zoom + 1; gMapControl1.Zoom = gMapControl1.Zoom - 1; }
private void BtnBack_Click(object sender, EventArgs e) { HideComponents(); CbDestiny_clear(); CbDestiny_Charge(nodes); Ruta.Clear(); capaRutas.Clear(); }
/// <summary> /// 移除编辑点 /// </summary> private void RemoveEditMarker() { //移除编辑点,删除图层 if (gmapControl.Overlays.Contains(overlay)) { overlay.Clear(); } }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { int rowIndex = e.RowIndex; String name = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();//获得本行name portSelOverlay.Clear(); showAirSpave(portOverlay, 0, 0, name); }
public void ResetOverlays() { gMap.Overlays.Clear(); foreach (GMapOverlay overlay in gMapOverlayList) { overlay.Clear(); } }
private void mapControl_MouseDown(object sender, MouseEventArgs e) { PointLatLng point = gMapControl1.FromLocalToLatLng(e.X, e.Y); skinTextBox3.Text = point.Lat.ToString(); skinTextBox4.Text = point.Lng.ToString(); portOverlay.Clear(); showAirSpave(portSelOverlay, point.Lat, point.Lng, "选中的点"); }
private void Clear_Click(object sender, EventArgs e) { points.Clear(); polygons.Clear(); routes.Clear(); ovPoints.Clear(); ovPolygons.Clear(); ovRoutes.Clear(); }
//Get Route and Distance private void button16_Click(object sender, EventArgs e) { if (currentMarker == null) { MessageBox.Show("Please set an orgin marker"); } if (listMarkers.Count == 0 && currentMarker != null) { MessageBox.Show("Please add a marker"); } if (listMarkers.Count > 0 && currentMarker != null) { routes.Clear(); MainMap.ReloadMap(); Dictionary <PointLatLng, string> points = new Dictionary <PointLatLng, string>(); foreach (var ml in listMarkers) { points.Add(ml.Value.Position, ml.Key); } splitPoint(points, ref mapRoutes); foreach (var r in mapRoutes) { r.Stroke = new Pen(Color.Red, 3); routes.Routes.Add(r); if (!listViewItems.Any(x => x.Text == r.Tag)) { listViewItems.Add(new ListViewItem(new[] { r.Tag.ToString(), r.Distance.ToString().Substring(0, 4) + " Km" })); } } listView1.Items.Clear(); foreach (var ii in listViewItems) { listView1.Items.Add(ii); } } }
void addmomRoute() { momrouteOverlay.Clear(); mompoints.Add(new PointLatLng(uav_list[1].lat, uav_list[1].lon)); //add points GMapRoute momroute = new GMapRoute(mompoints, "momroute"); //set route momroute.Stroke = new Pen(Color.Green, 1); momrouteOverlay.Routes.Add(momroute); gmap.Overlays.Add(momrouteOverlay); }
public void updateLocation(string updatedLocation) { r.Clear(); markerOverlay.Clear(); routeOverlay.Clear(); form.map.Overlays.Clear(); form.lblDistance.Text = ""; currentLocation = findLocation(updatedLocation); draw(); }
void addsonRoute() { sonrouteOverlay.Clear(); sonpoints.Add(new PointLatLng(uav_list[2].lat, uav_list[2].lon)); //add points GMapRoute sonroute = new GMapRoute(sonpoints, "momroute"); //set route sonroute.Stroke = new Pen(Color.Blue, 1); sonrouteOverlay.Routes.Add(sonroute); gmap.Overlays.Add(sonrouteOverlay); }
private void btn_Options_Traffic_Show_Click(object sender, EventArgs e) { if (!bw_Calculate.IsBusy) { // clear routes routes.Clear(); // start background worker bw_Calculate.RunWorkerAsync(); } }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { int rowIndex = e.RowIndex; String name = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); //获得本行name double lat = Convert.ToDouble(dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString()); //获得本行经度 double lang = Convert.ToDouble(dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString()); //获得本行纬度 portSelOverlay.Clear(); showWayPoint(portOverlay, lat, lang, name); }
public void llenarMapa(IList <string> caminos) { caminos.Reverse(); //la clase lo mando Destino-Origen //GMap.Net //limpiar marcas previas en el mapa gm_ciudades.Overlays.Clear(); //instancia para marcas de globo GMarkerGoogle m; //instancia para recolectar marcas GMapOverlay markersOverlay = new GMapOverlay("markers"); markersOverlay.Clear(); //instancia para recolectar rutas GMapOverlay routesOverlay = new GMapOverlay("routes"); routesOverlay.Clear(); //lista para guardar puntos de ciudades List <PointLatLng> points = new List <PointLatLng>(); //recorrer el camino foreach (string camino in caminos) { //posicionarse en el mapa gm_ciudades.SetPositionByKeywords(camino); //obtener tipo y la marca m = new GMarkerGoogle(gm_ciudades.Position, GMarkerGoogleType.purple_dot); //ponerle un texto m.ToolTipText = camino; //unir todos en marcas markersOverlay.Markers.Add(m); //agregar una ciudad a la lista para unir los puntos points.Add(new PointLatLng(gm_ciudades.Position.Lat, gm_ciudades.Position.Lng)); } //mostrar el paquete de marcas de globo gm_ciudades.Overlays.Add(markersOverlay); //instancia para empaquetar ruta agregando la lista GMapRoute route = new GMapRoute(points, "mypolygon"); //unir los puntos route.Stroke = new Pen(Color.Purple, 1); //empaquetarlo routesOverlay.Routes.Add(route); //mostrarlo en el mapa gm_ciudades.Overlays.Add(routesOverlay); gm_ciudades.Refresh(); }
private void Next_route_click(object sender, EventArgs e)//maintain switching between routes { RouteOverlay.Clear(); if (routecounter == CurrentRoutes.Count) { StepOverlay.Clear(); CurrentSteps.Clear(); if (allroutescounter != 0) { curier_text.Text = AllRoutes[allroutescounter - 1].Item2; } stepcounter = 0; routecounter = 0; return; } StepOverlay.Clear(); CurrentSteps.Clear(); stepcounter = 0; curier_text.Text = AllRoutes[allroutescounter - 1].Item2 + ": route " + (routecounter + 1).ToString(); for (int i = 0; i < CurrentRoutes[routecounter].route.Count - 1; i++) { List <LandPoint> temp = new List <LandPoint>(); temp.Add(CurrentRoutes[routecounter].route[i]); temp.Add(CurrentRoutes[routecounter].route[i + 1]); CurrentSteps.Add(temp); } for (int i = 1; i < CurrentRoutes[routecounter].route.Count; i++) { var route = GoogleMapProvider.Instance.GetRoute(CurrentRoutes[routecounter].route[i - 1].coordinates, CurrentRoutes[routecounter].route[i].coordinates, false, true, 10); GMapRoute gMapRoute = new GMapRoute(route.Points, i.ToString()) { Stroke = new Pen(Color.Blue, 3) }; GMarkerGoogle temp = new GMarkerGoogle(CurrentRoutes[routecounter].route[i - 1].coordinates, GMarkerGoogleType.blue); temp.ToolTip = new GMap.NET.WindowsForms.ToolTips.GMapRoundedToolTip(temp); temp.ToolTipText = CurrentRoutes[routecounter].route[i - 1].adress + CurrentRoutes[routecounter].Tooltips[i - 1]; BuildRoute(gMapRoute, temp); } routecounter++; }