void AddMarker(string uid, double lat, double lng) { var marker = new GMarkerGoogle(new PointLatLng(lat, lng), GMarkerGoogleType.blue); string name = string.Format("{0} - {1}:{2}", uid, lat, lng); marker.ToolTip = new GMapToolTip(marker); marker.ToolTipText = name; markersOverlay.Markers.Add(marker); }
private void buttonShowAllDepartments_Click(object sender, EventArgs e) { gMapControl1.Overlays.Clear(); foreach (var c in Program.banksSystem.Department) { //Создание маркера GMapOverlay markersOverlay = new GMapOverlay(c.Bank1.Id.ToString()); GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(c.Сoordinate_y, c.Сoordinate_x), GMarkerGoogleType.green); //Добавляем описание marker.ToolTip = new GMapRoundedToolTip(marker); marker.ToolTipText = c.Bank1.Name + "\n" + c.Name + "\n" + c.Address + "\n" + c.Phone + "\n"; var departmentCurrencies = (from depCurr in Program.banksSystem.DeprtmentsСurrencies join curr in Program.banksSystem.Сurrency on depCurr.Сurrency equals curr where depCurr.Department == c.Id select new { Currency = curr.Name, Buy = depCurr.Buy, Sell = depCurr.Sell }).ToList(); foreach (var cur in departmentCurrencies) { marker.ToolTipText += cur.Currency + " " + cur.Buy + " " + cur.Sell + "\n"; } //Добавляем на карту markersOverlay.Markers.Add(marker); gMapControl1.Overlays.Add(markersOverlay); //fix ставим на правильное место gMapControl1.Position = gMapControl1.Position; } }
private void MainForm_Load(object sender, EventArgs e) { gMapControl1.MapProvider = GoogleMapProvider.Instance; gMapControl1.Manager.Mode = AccessMode.ServerOnly; GMapProvider.WebProxy = null; gMapControl1.Position = new PointLatLng(ClientSettings.DefaultLatitude, ClientSettings.DefaultLongitude); gMapControl1.DragButton = MouseButtons.Left; gMapControl1.MinZoom = 1; gMapControl1.MaxZoom = 20; gMapControl1.Zoom = 15; gMapControl1.Overlays.Add(searchAreaOverlay); gMapControl1.Overlays.Add(pokestopsOverlay); gMapControl1.Overlays.Add(pokemonsOverlay); gMapControl1.Overlays.Add(playerOverlay); playerMarker = new GMarkerGoogle(new PointLatLng(ClientSettings.DefaultLatitude, ClientSettings.DefaultLongitude), GMarkerGoogleType.orange_small); playerOverlay.Markers.Add(playerMarker); InitializeMap(); InitializePokemonForm(); if (ClientSettings.TransferType == "Duplicate") { Settings.Instance.SetSetting("CP Duplicate", "TransferType"); Settings.Instance.Reload(); } }
/// <summary> /// Creates the map marker and adds it to the map /// </summary> public void CreateMapMarker(PointLatLng point, string tooltip) { GMarkerGoogle marker = new GMarkerGoogle(point, GMarkerGoogleType.red); marker.ToolTipText = tooltip; gmap.Overlays[0].Markers.Add(marker); gmap.UpdateMarkerLocalPosition(marker); }
private void Form1_Load(object sender, EventArgs e) { // Initialize map: gMapControl.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance; GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly; gMapControl.Position = new GMap.NET.PointLatLng(0.06,34); // gMapControl.SetPositionByKeywords("Embu, kenya"); //Placing a marker on a certain position GMapOverlay markersOverlay = new GMapOverlay("markers"); GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(0.06, 34.2), GMarkerGoogleType.green); marker.ToolTipText = "This is the first marker we put up"; marker.ToolTipMode = MarkerTooltipMode.OnMouseOver; markersOverlay.Markers.Add(marker); gMapControl.Overlays.Add(markersOverlay); GMapOverlay markersOverlaymaseno = new GMapOverlay("markers"); GMarkerGoogle masenomarker = new GMarkerGoogle(new PointLatLng(45, 45), GMarkerGoogleType.blue); masenomarker.ToolTipText = "This is the second marker we put up"; masenomarker.ToolTipMode = MarkerTooltipMode.OnMouseOver; markersOverlay.Markers.Add(masenomarker); gMapControl.Overlays.Add(markersOverlay); markersOverlay.Markers.Add(marker); gMapControl.Overlays.Add(markersOverlay); GMapOverlay markersOverlaythird = new GMapOverlay("markers"); GMarkerGoogle thirdmarker = new GMarkerGoogle(new PointLatLng(-45, 45), GMarkerGoogleType.red); thirdmarker.ToolTipText = "This is the third marker we put up"; thirdmarker.ToolTipMode = MarkerTooltipMode.OnMouseOver; markersOverlay.Markers.Add(thirdmarker); gMapControl.Overlays.Add(markersOverlay); GMapOverlay polyOverlay = new GMapOverlay("polygons"); List<PointLatLng> points = new List<PointLatLng>(); points.Add(new PointLatLng(-25.969562, 32.585789)); points.Add(new PointLatLng(-25.966205, 32.588171)); points.Add(new PointLatLng(-25.968134, 32.591647)); points.Add(new PointLatLng(-25.971684, 32.589759)); GMapPolygon polygon = new GMapPolygon(points, "mypolygon"); polygon.Fill = new SolidBrush(Color.FromArgb(50, Color.Red)); polygon.Stroke = new Pen(Color.Red, 1); polyOverlay.Polygons.Add(polygon); gMapControl.Overlays.Add(polyOverlay); }
public static void AddDefaultGoogleMarker(this Collection<GMapMarker> source, PointLatLng? point, GMarkerGoogleType style, object tag = null) { if (point != null) { GMarkerGoogle m = new GMarkerGoogle((PointLatLng)point, style); m.ToolTip = new GMapRoundedToolTip(m); m.ToolTipMode = MarkerTooltipMode.OnMouseOver; m.Tag = tag; source.Add(m); } }
private void handleLiveGeoLocations(GeoCoordinate coords) { this.Invoke(new MethodInvoker(() => { double lat = Convert.ToDouble(textBox1.Text); double lon = Convert.ToDouble(textBox2.Text); markersOverlay.Markers.Clear(); GMarkerGoogle marker = new GMarkerGoogle(new GMap.NET.PointLatLng(lat, lon), GMarkerGoogleType.red); markersOverlay.Markers.Add(marker); map.Overlays.Add(markersOverlay); map.Position = new GMap.NET.PointLatLng(coords.Latitude, coords.Longitude); })); }
private void button1_Click(object sender, EventArgs e) { //Создание маркера GMapOverlay markersOverlay = new GMapOverlay("markers"); GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(53.899906, 27.562688), GMarkerGoogleType.green); //Добавляем описание marker.ToolTip = new GMapRoundedToolTip(marker); marker.ToolTipText = "Красная площадь"; //Добавляем на карту markersOverlay.Markers.Add(marker); gMapControl1.Overlays.Add(markersOverlay); //fix ставим на правильное место gMapControl1.Position = new GMap.NET.PointLatLng(53.9018722, 27.6574339); }
private void pictureBox2_Click(object sender, EventArgs e) { //Drop a waypoint to my location give or take var r= new Random(); double randomLat=43.389758+0.0001*r.Next(-100,100); double randomLon=-80.405068+0.0001*r.Next(-100,100); GMarkerGoogle marker = new GMarkerGoogle(new GMap.NET.PointLatLng (randomLat, randomLon), GMarkerGoogleType.green_dot); m_markersOverlay.Markers.Add(marker); gMapControl1.Overlays.Add(m_markersOverlay); }
public override void Dispose() { if(Pen != null) { Pen.Dispose(); Pen = null; } if(InnerMarker != null) { InnerMarker.Dispose(); InnerMarker = null; } base.Dispose(); }
public static void createMarker(double x, double y, string name) { try { markersOverlay = new GMapOverlay("markers"); GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(x, y), GMarkerGoogleType.red_dot); DateTime dt = DateTime.Now; marker.ToolTipMode = MarkerTooltipMode.Always; marker.ToolTip = new GMapToolTip(marker); marker.ToolTipText = (x + ", " + y + ", " + dt.ToString("hh:mm:ss.ffff")); if (markers.Any() && markers.First().Value.AddMinutes(saveTimeFor) < DateTime.Now)//markersPlaced >= 6) { //markers.ElementAt(1).IsVisible = true; //markers.ElementAt(2).IsVisible = false; //markers.ElementAt(1).IsVisible = false; //markers.ElementAt(0).IsVisible = false; //markers.Last().Dispose(); overlays.ToList().First().Markers.Remove(markers.First().Key); markers.Remove(markers.First().Key); overlays.Remove(overlays.ToList().First()); } else { markersPlaced++; } markersOverlay.Markers.Add(marker); markers.Add(marker, dt); overlays.Add(markersOverlay); Program.mainForm.gMap.Invoke(new Action(() => { Program.mainForm.gMap.Overlays.Add(markersOverlay); Program.mainForm.gMap.Position = marker.Position; //gMap.Position = main; } )); } catch (Exception ex) { Console.WriteLine("Create Marker: " + ex); } }
private void destinationMenuItem_Click(object sender, EventArgs e) { GMarkerGoogle marker = new GMarkerGoogle(gPoint, GMarkerGoogleType.red); markers.Markers.Add(marker); PointLatLng start = new PointLatLng(markers.Markers[0].Position.Lat, markers.Markers[0].Position.Lng); PointLatLng end = new PointLatLng(markers.Markers[1].Position.Lat, markers.Markers[1].Position.Lng); MapRoute route = GMap.NET.MapProviders.GoogleMapProvider.Instance.GetRoute( start, end, false, false, 14 ); GMapRoute r = new GMapRoute(route.Points, "My route"); GMapOverlay routesOverlay = new GMapOverlay("routes"); routesOverlay.Routes.Add(r); myMap.Overlays.Add(routesOverlay); // Térkép frissítése a route felrakása után, különben csak egy zoomolás után látszik a route. myMap.UpdateRouteLocalPosition(r); myMap.Invalidate(); }
private void InfoObservable_HandlePokeStopInfoUpdate(POGOProtos.Map.Fort.FortData pokeStop, string info) { Invoke(new MethodInvoker(() => { try { if (_pokeStopsMarks.ContainsKey(pokeStop.Id)) { //changeType var bmp = Properties.MapData.visited_pokestop; if (pokeStop.ActiveFortModifier.Count > 0) { bmp = Properties.MapData.visited_lured_pokestop; } var newMark = new GMarkerGoogle(_pokeStopsMarks[pokeStop.Id].Position, bmp); newMark.ToolTipText = info; newMark.ToolTip.Font = new System.Drawing.Font("Arial", 12, System.Drawing.GraphicsUnit.Pixel); try { _pokeStopsOverlay.Markers[_pokeStopsOverlay.Markers.IndexOf(_pokeStopsMarks[pokeStop.Id])] = newMark; } catch (Exception e) { Logger.ColoredConsoleWrite(ConsoleColor.DarkRed, "Ignore this: sending exception information to log file."); Logger.AddLog(string.Format("Error in HandlePokeStopInfoUpdate: {0}", e.ToString())); } _pokeStopsMarks[pokeStop.Id] = newMark; } } catch (Exception e) { Logger.ColoredConsoleWrite(ConsoleColor.DarkRed, "Ignore this: sending exception information to log file."); Logger.AddLog(string.Format("Error in HandlePokeStopInfoUpdate: {0}", e.ToString())); } })); }
private void Form1_Load_1(object sender, EventArgs e) { this.gMapControl1.BackColor = Color.Red; //设置控件的管理模式 this.gMapControl1.Manager.Mode = AccessMode.ServerAndCache; //设置控件显示的地图来源 this.gMapControl1.MapProvider = GMapProviders.GoogleChinaMap; //设置控件显示的当前中心位置 gp = GMapProviders.OpenStreetMap as GeocodingProvider; //31.7543, 121.6281 this.gMapControl1.Position = new PointLatLng(28.210422, 112.976478); //设置控件最大的缩放比例 this.gMapControl1.MaxZoom = 18; //设置控件最小的缩放比例 this.gMapControl1.MinZoom = 1; //设置控件当前的缩放比例 this.gMapControl1.Zoom = 11; //创建一个新图层 routes = new GMapOverlay("routes"); MyMark = new GMapOverlay("MyMark"); routes.IsVisibile = true;//可以显示 MyMark.IsVisibile = true; this.gMapControl1.Overlays.Add(routes);//添加到图层列表中 this.gMapControl1.Overlays.Add(MyMark); //创建一个图标 GMapMarker gMapMarker = new GMarkerGoogle(gMapControl1.Position, GMarkerGoogleType.arrow); //添加图层routes中 gMapMarker.ToolTipText = "我的商店"; this.MyMark.Markers.Add(gMapMarker); // this.gMapControl1.Dock = DockStyle.Fill;//将控件全屏显示 gMapControl1.Overlays.Add(polygons); }
public void CreateBotMarker(int team, int level, long exp) { Bitmap bmp = Properties.MapData.player; switch (team) { case 1: bmp = Properties.MapData.player_blue; break; case 2: bmp = Properties.MapData.player_red; break; case 3: bmp = Properties.MapData.player_yellow; break; } routeOverlay.IsVisibile = false; PointLatLng pointLatLng; if (_botMarker != null) { pointLatLng = _botMarker.Position; routeOverlay.Markers.Remove(_botMarker); } else { pointLatLng = new PointLatLng(); } _botMarker = new GMarkerGoogle(pointLatLng, bmp); _botMarker.ToolTipText = string.Format("Level: {0} ({1})", level, exp); _botMarker.ToolTip.Font = new System.Drawing.Font("Arial", 12, System.Drawing.GraphicsUnit.Pixel); _botMarker.ToolTipMode = MarkerTooltipMode.OnMouseOver; routeOverlay.Markers.Add(_botMarker); routeOverlay.IsVisibile = true; }
private void FormRestaurantMap_Load(object sender, EventArgs e) { GMapProviders.GoogleMap.ApiKey = Properties.Settings.Default.Google_API_KEY; GMaps.Instance.Mode = AccessMode.ServerAndCache; mainMap.CacheLocation = @"CacheMaps"; mainMap.DragButton = MouseButtons.Left; mainMap.MapProvider = GMapProviders.GoogleMap; mainMap.ShowCenter = false; mainMap.MinZoom = 5; mainMap.MaxZoom = 30; mainMap.Zoom = 18; double lat; double lng; if (this.restaurant != null) { lat = this.restaurant.Lat; lng = this.restaurant.Lng; } else { lat = 10.9806545; lng = 106.672259; } mainMap.Position = new PointLatLng(lat, lng); PointLatLng point = new PointLatLng(lat, lng); GMapMarker marker = new GMarkerGoogle(point, GMarkerGoogleType.red_big_stop); GMapOverlay markers = new GMapOverlay("markers"); markers.Markers.Add(marker); mainMap.Overlays.Add(markers); }
private void btnSucheStaton_Click(object sender, EventArgs e) { try{ Stationssuche neuesuche = new Stationssuche(); Setvonkodinaten(neuesuche.GetKordinaten(txtboxstation.Text)); gmapKarte.DragButton = MouseButtons.Left; gmapKarte.CanDragMap = true; gmapKarte.MapProvider = GMapProviders.GoogleMap; gmapKarte.Position = new PointLatLng(vonX, vonY); gmapKarte.MinZoom = 5; gmapKarte.MaxZoom = 25; gmapKarte.Zoom = 10; gmapKarte.AutoScroll = true; GMapOverlay markerOverlay = new GMapOverlay("makers"); GMarkerGoogle marker = new GMarkerGoogle(new GMap.NET.PointLatLng(vonY, vonX), GMarkerGoogleType.green_pushpin); markerOverlay.Markers.Add(marker); gmapKarte.Overlays.Add(markerOverlay); gmapKarte.Refresh(); } catch { MessageBox.Show("Keine Station gefunden!"); } }
private void addpolygonmarkergrid(string tag, double lng, double lat, int alt) { try { PointLatLng point = new PointLatLng(lat, lng); GMarkerGoogle m = new GMarkerGoogle(point, GMarkerGoogleType.red); m.ToolTipMode = MarkerTooltipMode.Never; m.ToolTipText = "grid" + tag; m.Tag = "grid" + tag; //MissionPlanner.GMapMarkerRectWPRad mBorders = new MissionPlanner.GMapMarkerRectWPRad(point, (int)float.Parse(TXT_WPRad.Text), MainMap); GMapMarkerRect mBorders = new GMapMarkerRect(point); { mBorders.InnerMarker = m; } drawnpolygonsoverlay.Markers.Add(m); drawnpolygonsoverlay.Markers.Add(mBorders); } catch (Exception ex) { // log.Info(ex.ToString()); } }
private void frmimprimirmapa_Load(object sender, EventArgs e) { //DibujarLotes(); gMapControl1.DragButton = MouseButtons.Left; gMapControl1.CanDragMap = true; gMapControl1.MapProvider = GMapProviders.GoogleMap; gMapControl1.Position = new PointLatLng(latitud, longitud); gMapControl1.MinZoom = 0; gMapControl1.MaxZoom = 24; gMapControl1.Zoom = 15; gMapControl1.AutoScroll = true; //markador markeroverlay = new GMapOverlay("Marcador"); marker = new GMarkerGoogle(new PointLatLng(latitud, longitud), GMarkerGoogleType.green); markeroverlay.Markers.Add(marker); //agregamos al mapa //agregamos un tooltip a los marcadores //marker.ToolTipMode = MarkerTooltipMode.Always; //marker.ToolTipText = string.Format("Ubicacion: \n Latitud: {0} \n Longitud:{1}", latinicial, lnginicial); //ahora agregamos el mapa y el control al mapcontrol gMapControl1.Overlays.Add(markeroverlay); }
public newRouteControl() { InitializeComponent(); gMapControl1.ShowCenter = false; gMapControl1.RoutesEnabled = true; gMapControl1.CanDragMap = true; gMapControl1.MarkersEnabled = true; gMapControl1.DragButton = MouseButtons.Left; GoogleMapProvider.Language = LanguageType.Russian; GMapProviders.GoogleMap.ApiKey = @"AIzaSyCyUssDzzAFVD5sqSoy-X_L5fEvC-JyMhU"; gMapControl1.MapProvider = GMapProviders.GoogleMap; gMapControl1.MinZoom = 2; gMapControl1.MaxZoom = 20; gMapControl1.Zoom = 16; GMaps.Instance.Mode = AccessMode.ServerOnly; gMapControl1.Position = new PointLatLng(58.01625927, 56.27706885); GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(58.01625927, 56.27706885), GMarkerGoogleType.red); GMapOverlay overlay = new GMapOverlay("markers"); overlay.Markers.Add(marker); gMapControl1.Overlays.Add(overlay); }
private void tvListTram_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { if (currentMarker != null) { currentMarker.ToolTip.Fill = Brushes.Gray; } if (currentMarkerMap != null) { currentMarkerMap.ToolTip.Fill = Brushes.Gray; } var result = Markers.Where(x => x.Tag.Equals(e.Node.Tag)).FirstOrDefault(); if (result != null) { currentMarker = (GMarkerGoogle)result; result.ToolTip.Fill = Brushes.Brown; this.gmap.Position = new PointLatLng(result.Position.Lat, result.Position.Lng); } tvListTram.SelectedNode = e.Node; tvListTram.Focus(); }
//public void DrawLine(PointLatLng [] a, int k, string [] p_name,GMapOverlay gMapOverlay, GMapControl gMap1)//6月20日10:30 //{ // for (int i = 0; i < k; i++) //输入k次值,从k 次值中取出前后a[i],a[i+1]连线 // { // GMapMarker gMapMarker = new GMarkerGoogle(a[i], GMarkerGoogleType.green);//起点 // gMapMarker.ToolTipText = "Start:"+p_name[i]; //标记设置6-18-22:00 // gMapMarker.ToolTipMode = MarkerTooltipMode.OnMouseOver; //标记模式鼠标放上面显示 // gMapOverlay.Markers.Add(gMapMarker); // gMap1.Overlays.Add(gMapOverlay); // if (i + 1 < k) // { // GMapMarker gMapMarker1 = new GMarkerGoogle(a[i + 1], GMarkerGoogleType.blue);//;终点类型为蓝色 // gMapMarker1.ToolTipText = "End:"+p_name[i+1]; //标记设置 // gMapMarker1.ToolTipMode = MarkerTooltipMode.OnMouseOver; //标记模式 // gMapOverlay.Markers.Add(gMapMarker1); // gMap1.Overlays.Add(gMapOverlay); // DrawLineBetweenTwoPoint(a[i], a[i + 1], gMapOverlay); // } // else if(i+1==k) // { // GMapMarker gMapMarker1 = new GMarkerGoogle(a[i + 1], GMarkerGoogleType.blue);//;终点类型为蓝色 // gMapMarker1.ToolTipText = "End:" + p_name[i + 1]; //标记设置 // gMapMarker1.ToolTipMode = MarkerTooltipMode.OnMouseOver; //标记模式 // gMapOverlay.Markers.Add(gMapMarker1); // gMap1.Overlays.Add(gMapOverlay); // } // } //} public void DrawLine(PointLatLng[] a, int k, string[] p_name, GMapOverlay gMapOverlay, GMapControl gMap1) //6月20日10:30 { for (int i = 0; i < k - 1; i++) //输入k次值,从k 次值中取出前后a[i],a[i+1]连线 { GMapMarker gMapMarker = new GMarkerGoogle(a[i], GMarkerGoogleType.green); //起点 gMapMarker.ToolTipText = "Start:" + p_name[i] + a[i]; //标记设置6-18-22:00 gMapMarker.ToolTipMode = MarkerTooltipMode.OnMouseOver; //标记模式鼠标放上面显示 gMapOverlay.Markers.Add(gMapMarker); gMap1.Overlays.Add(gMapOverlay); if (i + 1 < k) { GMapMarker gMapMarker1 = new GMarkerGoogle(a[i + 1], GMarkerGoogleType.blue); //;终点类型为蓝色 gMapMarker1.ToolTipText = "End:" + p_name[i + 1] + a[i + 1]; //标记设置 gMapMarker1.ToolTipMode = MarkerTooltipMode.OnMouseOver; //标记模式 gMapOverlay.Markers.Add(gMapMarker1); gMap1.Overlays.Add(gMapOverlay); DrawLineBetweenTwoPoint(a[i], a[i + 1], gMapOverlay); } } } //修正版备份16:42
private void buttonGoTo_Click(object sender, EventArgs e) { double lat = Convert.ToDouble(textBoxLatitude.Text); double lng = Convert.ToDouble(textBoxLongtitude.Text); if (nomer_titik == 0) { GMapOverlay markersOverlay = new GMapOverlay("markers"); posisi_pesawat = new GMarkerGoogle(new PointLatLng(lat, lng), new Bitmap(@"C:\Users\Febby Ronaldo\Documents\Visual Studio 2013\Projects\GUI_KRTI_BismillahNyoba\GUI_KRTI_BismillahNyoba\bin\Debug\mdrone.png")); posisi_pesawat.ToolTipText = lat + "," + lng; posisi_pesawat.ToolTipMode = MarkerTooltipMode.Always; markersOverlay.Markers.Add(posisi_pesawat); gMapControl2.Overlays.Add(markersOverlay); gMapControl2.Position = new PointLatLng(lat, lng); nomer_titik++; } else { posisi_pesawat.Position = new PointLatLng(lat, lng); posisi_pesawat.ToolTipText = lat + "," + lng; } gMapControl2.Invalidate(); }
/// <summary> /// find nearest exhanger from current mouse position /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void findNearestToolStripMenuItem_Click(object sender, EventArgs e) { PointLatLng objPosition = GetCursorPosition(); using (var objProvider = new BankProvider()) { List <CurrencyExchanger> objExchangers = new List <CurrencyExchanger>(); foreach (var marker in objMarkersOverlay.Markers) { CurrencyExchanger exchanger = objProvider.GetExchangerById((int)marker.Tag); if (exchanger != null) { objExchangers.Add(exchanger); } } CurrencyExchanger objNearestExchanger = objProvider.GetNearestExchanger(objPosition.Lat, objPosition.Lng, objExchangers); var objMarker = new GMarkerGoogle(new PointLatLng(objNearestExchanger.X, objNearestExchanger.Y), GMarkerGoogleType.blue); objMarker.Tag = objNearestExchanger.Id; gMapControl1.UpdateMarkerLocalPosition(objMarker); var markersOverlay = new GMapOverlay(); markersOverlay.Markers.Add(objMarker); gMapControl1.Overlays.Add(markersOverlay); } }
private void materialRaisedButton2_Click(object sender, EventArgs e) { try { DialogResult dialogResult = MessageBox.Show("Done the Query?", "HCSys", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dialogResult == DialogResult.OK) { gMapControl2.Overlays.Remove(Map.markersOverlay2); ListViewItem item = materialListView1.SelectedItems[0]; var FQuery = "UPDATE terminal_request SET Is_Done=1 WHERE Id=@Id"; Connexion.db.Execute(FQuery, new { Id = item.SubItems[0].Text }); var Data = terminal_request.GetDiscription(item.SubItems[0].Text); Map.markersOverlay2 = new GMapOverlay(item.SubItems[0].Text); GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(Convert.ToDouble(Data[0].Latitude), Convert.ToDouble(Data[0].Longitude)), GMarkerGoogleType.red); Map.markersOverlay2.Markers.Add(marker); gMapControl2.Overlays.Add(Map.markersOverlay2); Map.GoTo(new PointLatLng(Convert.ToDouble(Data[0].Latitude), Convert.ToDouble(Data[0].Longitude)), gMapControl2); RefreshGridRequest(); } } catch (Exception) { } }
private void markerAssignation() { Hashtable temp = manager.getDivisions(); foreach (DictionaryEntry element in temp) { Division div = (Division)element.Value; List <Entrance> ent = div.GetEntrances(); foreach (Entrance entry in ent) { if (div.getName().Equals("BMT")) { GMapMarker marker = new GMarkerGoogle(new PointLatLng(entry.getLatitude(), entry.getLongitude()), GMarkerGoogleType.blue_dot); BMTmarkers.Markers.Add(marker); } else if (div.getName().Equals("IRT")) { GMapMarker marker = new GMarkerGoogle(new PointLatLng(entry.getLatitude(), entry.getLongitude()), GMarkerGoogleType.orange_dot); IRTmarkers.Markers.Add(marker); } if (div.getName().Equals("IND")) { GMapMarker marker = new GMarkerGoogle(new PointLatLng(entry.getLatitude(), entry.getLongitude()), GMarkerGoogleType.red_dot); INDmarkers.Markers.Add(marker); } } } gMap.Overlays.Add(BMTmarkers); gMap.Overlays.Add(IRTmarkers); gMap.Overlays.Add(INDmarkers); }
private void LoadMarkers() { if (markersOverlay == null) { markersOverlay = new GMapOverlay("markers"); gmap.Overlays.Add(markersOverlay); } else { markersOverlay.Markers.Clear(); } for (int i = 0; i < data.Ports.Count; i++) { var port = data.Ports[i]; var marker = new GMarkerGoogle(port.Location, Properties.Resources.blue); marker.Offset = new System.Drawing.Point(-12, -12); marker.Tag = port; marker.ToolTipText = port.Name; marker.ToolTipMode = MarkerTooltipMode.OnMouseOver; marker.ToolTip.Font = new System.Drawing.Font(marker.ToolTip.Font.FontFamily, 10); markersOverlay.Markers.Add(marker); } }
private void dataPuntos_CellContentClick(object sender, DataGridViewCellEventArgs e) { marcadores.Clear(); int index = dataPuntos.CurrentRow.Index; Servicio temporal = user.ServiciosRegistrados[index]; String[] inicio = temporal.Partida.Split('*'); double i1 = Double.Parse(inicio[0]); double i2 = Double.Parse(inicio[1]); string[] fin = temporal.Destino.Split('*'); double f1 = Double.Parse(fin[0]); double f2 = Double.Parse(fin[1]); PointLatLng start = new PointLatLng(i1, i2); PointLatLng end = new PointLatLng(f1, f2); GMapMarker partida; partida = new GMarkerGoogle(start, GMarkerGoogleType.red); partida.ToolTipText = "Partida"; partida.ToolTipMode = MarkerTooltipMode.Always; marcadores.Markers.Add(partida); GMapMarker destino; destino = new GMarkerGoogle(end, GMarkerGoogleType.red); destino.ToolTipText = "Destino"; destino.ToolTipMode = MarkerTooltipMode.Always; marcadores.Markers.Add(destino); gMapPuntos.Overlays.Add(marcadores); gMapPuntos.Refresh(); gMapPuntos.ReloadMap(); }
private void gMapControl1_Load(object sender, EventArgs e) { gMapControl1.DragButton = MouseButtons.Left; gMapControl1.CanDragMap = true; gMapControl1.SetPositionByKeywords("Paris"); gMapControl1.MapProvider = GMapProviders.GoogleMap; gMapControl1.MinZoom = 3; gMapControl1.MaxZoom = 24; gMapControl1.Zoom = 9; gMapControl1.AutoScroll = true; gMapControl1.Manager.Mode = AccessMode.ServerAndCache; overlayOne = new GMapOverlay("OverlayOne"); gMapControl1.Position = new PointLatLng(48.864716, 2.349014); GMarkerGoogle marker = new GMarkerGoogle(gMapControl1.Position, GMarkerGoogleType.pink); overlayOne.Markers.Add(marker); gMapControl1.Overlays.Add(overlayOne); strana.Items.Add("nasi"); strana.Items.Add("neprijatelj"); mr.Items.Add("marker"); mr.Items.Add("rute"); konacno.Text += " \r \r"; konacno.Text += "Postavljanje markera:" + " \r"; konacno.Text += "1. Definirati ime i vrstu markera i dodati ga u izbornik" + "\r"; konacno.Text += "2. Izabrati marker iz izbornika i definirati da li je prijatelj/neprijatelj" + "\r"; konacno.Text += "3. Definirati da li želite postaviti rutu ili marker" + "\r"; konacno.Text += "4. DOUBLE CLICK na poziciju gdje želite postaviti marker" + "\r" + "\r"; konacno.Text += "Postavljanje rute:" + " \r"; konacno.Text += "1. Definirati da želiš postaviti rutu a ne marker" + "\r"; konacno.Text += "2. CLICK na marker ili na već postavljenu rutu kojoj želiš pridodati novu (početna točka rute)" + "\r"; konacno.Text += "4. DOUBLE CLICK na poziciju gdje želiš da nova ruta završava (završna točka rute)" + "\r" + "\r"; konacno.Text += "NAPOMENA: na kartu se ne smije zapiknuti dva puta isti marker na različite pozicije, nisam još sredila taj dio, ali bude.." + "\r" + "\r"; }
//************************************************************************************************** private void dgvListeTechniciens_CellClick(object sender, DataGridViewCellEventArgs e) { int IdxLigneActuelle = e.RowIndex; // indice de la ligne sélectionnée String prenom = (String)dgvListeTechniciens.Rows[IdxLigneActuelle].Cells[1].Value; String nom = (String)dgvListeTechniciens.Rows[IdxLigneActuelle].Cells[2].Value; // recherche du marqueur correspondant au technicien sélectionné for (int index = 0; index < overlayOne.Markers.Count; index++) { if (overlayOne.Markers[index].ToolTipText == (prenom + " " + nom)) { // Marqueur technicien trouvé GMarkerGoogle markerTechnicien = (GMarkerGoogle)overlayOne.Markers[index]; if (markerTechnicien.Type == (GMarkerGoogleType.green)) { // Il faut faire passer le marqueur rouge en vert // On supprime le marqueur rouge et on en crée un en vert avec les mêmes données if (markerTechnicienEnRouge != null) { GMarkerGoogle newMarkerTechnicienVert = new GMarkerGoogle(markerTechnicienEnRouge.Position, GMarkerGoogleType.green); newMarkerTechnicienVert.ToolTipText = markerTechnicienEnRouge.ToolTipText; overlayOne.Markers.Remove(markerTechnicienEnRouge); overlayOne.Markers.Add(newMarkerTechnicienVert); markerTechnicienEnRouge = null; } // On enlève le marque vert pour le remplacer par un rouge overlayOne.Markers.Remove(markerTechnicien); markerTechnicien = new GMarkerGoogle(markerTechnicien.Position, GMarkerGoogleType.red); markerTechnicien.ToolTipText = prenom + " " + nom; overlayOne.Markers.Add(markerTechnicien); markerTechnicienEnRouge = markerTechnicien; calculerTrajet(); } } } }
private void MarkedAllLocation() { if (locationHistories.Count == 0) { return; } InitGmap(); bool isFrist = true; foreach (LocationMessage l in locationHistories) { var styleMarker = isFrist ? GMarkerGoogleType.red : GMarkerGoogleType.red_small; GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(l.latitude, l.longitude), styleMarker) { ToolTipText = l.timeTracking.ToString("dd/MM/yy HH:mm:ss") }; gMapOverlay.Markers.Add(marker); isFrist = false; } //TODO fix here //for (int i = 0; i < locationHistories.Count - 1; i++) //{ // JsonLocationHistory s = (JsonLocationHistory)locationHistories[0]; // JsonLocationHistory e = (JsonLocationHistory)locationHistories[0]; // PointLatLng start = new PointLatLng(s.latitude, s.longitude); // PointLatLng end = new PointLatLng(e.latitude, e.longitude); // MapRoute route = GMap.NET.MapProviders.GoogleMapProvider.Instance.GetRoute(start, end, false, false, 15); // GMapRoute r = new GMapRoute(route.Points, "a"); // gMapOverlay.Routes.Add(r); //} gMap.Overlays.Add(gMapOverlay); LocationMessage locationHistory = (LocationMessage)locationHistories[0]; gMap.Position = new GMap.NET.PointLatLng(locationHistory.latitude, locationHistory.longitude); }
public static void addNode(int nodeNum, double x, double y) { try { markersOverlay = new GMapOverlay("markers"); PointLatLng point = new PointLatLng(x, y); GMarkerGoogle markerNode = new GMarkerGoogle(point, GMarkerGoogleType.green); markersOverlay.Markers.Add(markerNode); markerNode.ToolTipMode = MarkerTooltipMode.Always; markerNode.ToolTip = new GMapToolTip(markerNode); markerNode.ToolTipText = "Node " + nodeNum; Program.mainForm.gMap.Invoke(new Action(() => { Program.mainForm.gMap.Overlays.Add(markersOverlay); Program.mainForm.gMap.Position = point; //gMap.Position = main; //Program.mainForm.addMarker(marker, markersOverlay, name); //Program.mainForm.addNode(nodeNum, x, y, markersOverlay); //gMap.Position = main; } )); } catch (Exception ex) { Console.WriteLine("Add Node: " + ex.Message); } }
private void Rutas_Load_1(object sender, EventArgs e) { dt = new DataTable(); dt.Columns.Add(new DataColumn("Descripcion", typeof(string))); dt.Columns.Add(new DataColumn("Latitud", typeof(double))); dt.Columns.Add(new DataColumn("Longitud", typeof(double))); //insertamos datos al dt dt.Rows.Add("Ubicacion 1", LatInicial, LngInicial); dataGridView1.DataSource = dt; //escondemos la longitud y la latitud dataGridView1.Columns[1].Visible = false; dataGridView1.Columns[2].Visible = false; gMapControl1.DragButton = MouseButtons.Left; gMapControl1.CanDragMap = true; gMapControl1.MapProvider = GMapProviders.GoogleMap; gMapControl1.Position = new PointLatLng(LatInicial, LngInicial); gMapControl1.MinZoom = 0; gMapControl1.MaxZoom = 24; gMapControl1.Zoom = 9; gMapControl1.AutoScroll = true; //marcador markerOverlay = new GMapOverlay("Marcador"); marker = new GMarkerGoogle(new PointLatLng(LatInicial, LngInicial), GMarkerGoogleType.red); markerOverlay.Markers.Add(marker);//agregamos al Mapa //texto a los marcadores marker.ToolTipMode = MarkerTooltipMode.Always; marker.ToolTipText = string.Format("Ubicacion: \n Latitud:{0} \n Longitud:{1}", LatInicial, LngInicial); //agregamos al mapa gMapControl1.Overlays.Add(markerOverlay); }
/// <summary> /// Callback to display coordinates in the 2 TextBox /// </summary> /// <param name="e">event</param> public void BaseOnMouseClick(MouseEventArgs e) { // Pas de modification, on en profite juste pour coller les coordonnées dans les controles s'ils existent PointLatLng pt = this.FromLocalToLatLng(e.X, e.Y); if (_controlTextLatLon != null) { _controlTextLatLon.Text = pt.Lat.ToString().Replace(",", ".") + " " + pt.Lng.ToString().Replace(",", "."); // On crée un markeur this.Overlays[GMapWrapper.RESERVED2].Markers.Clear(); GMapMarker marker = new GMarkerGoogle(pt, GMarkerGoogleType.red_pushpin); this.Overlays[GMapWrapper.RESERVED2].Markers.Add(marker); if (_controlTextRadius != null) { String s = _controlTextRadius.Text; double radius; if (Double.TryParse(s, out radius)) { if (!_daddy._bUseKm) { radius = radius / _daddy._dConvKmToMi; } // On crée un cercle Color c = Color.Green; c = Color.FromArgb(60, c.R, c.G, c.B); Brush brush = new SolidBrush(c); Pen pen = new Pen(c, 2); GMapMarkerCircle circle = new GMapMarkerCircle(this, pt, (int)(radius * 1000.0), pen, brush, true); this.Overlays[GMapWrapper.RESERVED2].Markers.Add(circle); } } } base.OnMouseClick(e); }
private void Form1_Load(object sender, EventArgs e) { dt = new DataTable(); dt.Columns.Add(new DataColumn("Descripcion", typeof(string))); dt.Columns.Add(new DataColumn("Latitud", typeof(double))); dt.Columns.Add(new DataColumn("Longitud", typeof(double))); //Insertando datos al dt para mostrar en la lista // dt.Rows.Add("Ubicacion 1", LatInicial, LngInicial); dataGridView1.DataSource = dt; // desactivar las columnas de lat y long // dataGridView1.Columns[1].Visible = false; // dataGridView1.Columns[2].Visible = false; gMapControl1.DragButton = MouseButtons.Left; gMapControl1.CanDragMap = true; gMapControl1.MapProvider = GMapProviders.GoogleMap; gMapControl1.Position = new PointLatLng(LatInicial, LngInicial); gMapControl1.MinZoom = 0; gMapControl1.MaxZoom = 24; gMapControl1.Zoom = 16; gMapControl1.AutoScroll = true; // Marcador markerOverlay = new GMapOverlay("Marcador"); marker = new GMarkerGoogle(new PointLatLng(LatInicial, LngInicial), GMarkerGoogleType.green_dot); markerOverlay.Markers.Add(marker); //Agregamoss al mapa //agregamos un tooltip de texto a los marcadores. marker.ToolTipMode = MarkerTooltipMode.Always; marker.ToolTipText = string.Format("Ubicacion: \n Latitud:{0} \n Longitud: {1}", LatInicial, LngInicial); //Agregamos el mapa y el marcador al map control gMapControl1.Overlays.Add(markerOverlay); }
private void Form1_Load(object sender, EventArgs e) { my_init_gmaps(); Bitmap bmpPrajurit = new Bitmap(System.IO.Path.Combine(Application.StartupPath, @"img\marker50.png")); Bitmap bmpMarkerPrajurit = bmpPrajurit; markerPrajurit = new GMarkerGoogle(new PointLatLng(-7.220091, defaultLngMarkas), bmpMarkerPrajurit); Bitmap bmpMarkas = new Bitmap(System.IO.Path.Combine(Application.StartupPath, @"img\marker502.png")); Bitmap bmpMarkerMarkas = bmpMarkas; markerMarkas = new GMarkerGoogle(new PointLatLng(defaultLatMarkas, defaultLngMarkas), bmpMarkerMarkas); markersOverlay.Markers.Add(markerMarkas); markersOverlay.Markers.Add(markerPrajurit); gMapControl1.Overlays.Add(markersOverlay); myKonekDB(); myBacaTabel(); int i = 0; //C:\Users\win10\Documents //string[] dirs = Directory.GetFiles(@"C:\Users\win10\Documents"); string[] dirs = Directory.GetFileSystemEntries(System.IO.Path.Combine(Application.StartupPath, @"video")); foreach (string dir in dirs) { listView1.Items.Add(dir, i); //i++; //if (i == imageList1.Images.Count - 1) // i = 0; } }
async void findRouteViaOpenMap() { gmap.Overlays.Where(o => o.Id == "Myroutes").ToList()[0].Routes.Clear(); string[] location1 = textbox_location1.Text.Split(new char[] { ',' }); string[] location2 = textbox_location2.Text.Split(new char[] { ',' }); var client = new HttpClient(); client.BaseAddress = new Uri(@"http://www.yournavigation.org/api/dev/route.php?flat=" + location1[0] + "&flon=" + location1[1] + "&tlat=" + location2[0] + "&tlon=" + location2[1] + "&v=motorcar&fast=" + (radioButton_fastest.Checked ? "1" : "0") + "&layer=mapnik&instructions=0"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/xml")); HttpResponseMessage response = await client.GetAsync(""); String result = await response.Content.ReadAsStringAsync(); label_distance.Text = Regex.Match(result.Replace('\n', ' ').Replace('\r', ' '), "<distance>(.*?)</distance>").Groups[1].Value + " km"; String coordinates = Regex.Match(result.Replace('\n', ' ').Replace('\r', ' '), "<coordinates>(.*?)</coordinates>").Groups[1].Value; Bitmap bmp = new Bitmap(Properties.Resources.dotGreen, new Size(15, 15)); route.Markers.Clear(); foreach (string coordinate in coordinates.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)) { string[] langLong = coordinate.Split(new char[] { ',' }); GMapMarker marker = new GMarkerGoogle( new PointLatLng(double.Parse(langLong[1]), double.Parse(langLong[0])), bmp); route.Markers.Add(marker); } gmap.Overlays.Remove(route); gmap.Overlays.Add(route); gmap.Refresh(); gmap.ReloadMap(); }
private void btnLocalizar_Click(object sender, EventArgs e) { gMapControlJeanette.DragButton = MouseButtons.Left; gMapControlJeanette.CanDragMap = true; try { double lat = Convert.ToDouble(DgvGeoDatos.CurrentRow.Cells[1].Value.ToString()); double longit = Convert.ToDouble(DgvGeoDatos.CurrentRow.Cells[2].Value.ToString()); gMapControlJeanette.MapProvider = GMapProviders.GoogleMap; gMapControlJeanette.Position = new PointLatLng(lat, longit); gMapControlJeanette.MinZoom = 0; gMapControlJeanette.MaxZoom = 35; //Maximo zoom gMapControlJeanette.Zoom = 17; gMapControlJeanette.AutoScroll = true; PointLatLng point = new PointLatLng(lat, longit); //MARKER GMapMarker gMapMarker = new GMarkerGoogle(point, GMarkerGoogleType.blue); // crear superposición GMapOverlay markers1 = new GMapOverlay("Markers"); //añadir todas las marcas disponibles a esa superposición markers1.Markers.Add(marker); // cubrir mapa con superposición gMapControlJeanette.Overlays.Add(markers1); //MARCADOR markerOverlay = new GMapOverlay("Marcador"); marker = new GMarkerGoogle(new PointLatLng(lat, longit), GMarkerGoogleType.blue); markerOverlay.Markers.Add(marker);//Agregamos al mapa //agregamos un tooltip de texto a los marcadores marker.ToolTipMode = MarkerTooltipMode.Always; marker.ToolTipText = string.Format("Ubicacion:\n Latitud: {0} \n Longitud: {1}", lat, longit); //Ahora agregamos el mapa y el marcador al map control gMapControlJeanette.Overlays.Add(markerOverlay); CreateCircle(lat, longit, 100.899431); } catch { MessageBox.Show("Seleccione fila"); } }
private void Form1_Load(object sender, EventArgs e) { gMapControl.DragButton = MouseButtons.Left; gMapControl.CanDragMap = true; gMapControl.MapProvider = GMapProviders.GoogleMap; gMapControl.Position = new PointLatLng(LatInicial, LngInicial); gMapControl.MinZoom = 0; gMapControl.MaxZoom = 19; gMapControl.Zoom = 35; gMapControl.AutoScroll = true; //Marcador markerOverlay = new GMapOverlay("Marcador"); marker = new GMarkerGoogle(new PointLatLng(LatInicial, LngInicial), GMarkerGoogleType.blue); //Agregamos el primer marcador markerOverlay.Markers.Add(marker); //Agregamos un toolTip de texto a los marcadores marker.ToolTipMode = MarkerTooltipMode.Always; marker.ToolTipText = string.Format("Ubicación: \n Latitud: {0} \n Longitud: {1}", LatInicial, LngInicial); //Agregamos al mapa el marcador gMapControl.Overlays.Add(markerOverlay); }
void infoObservable_HandleNewPokemonLocation(MapPokemon mapPokemon) { Invoke(new MethodInvoker(() => { if (!_pokemonMarks.ContainsKey(mapPokemon.SpawnPointId)) { GMarkerGoogle pokemonMarker; Bitmap pokebitMap = PokeImgManager.GetPokemonMediumImage(mapPokemon.PokemonId); if (pokebitMap != null) { var ImageSize = new System.Drawing.Size(pokebitMap.Width, pokebitMap.Height); pokemonMarker = new GMarkerGoogle(new PointLatLng(mapPokemon.Latitude, mapPokemon.Longitude), pokebitMap) { Offset = new System.Drawing.Point(-ImageSize.Width / 2, -ImageSize.Height / 2) }; } else { pokemonMarker = new GMarkerGoogle(new PointLatLng(mapPokemon.Latitude, mapPokemon.Longitude), GMarkerGoogleType.green_small); } var expriationTime = StringUtils.TimeMStoString(mapPokemon.ExpirationTimestampMs, @"mm\:ss"); Logger.Debug("Expires in: " + expriationTime); var address = LocationUtils.FindAddress(mapPokemon.Latitude, mapPokemon.Longitude); pokemonMarker.ToolTipText = th.TS("{0}\nExpires in: {1}\n{2}\n{3},{4}", new object[] { mapPokemon.PokemonId, expriationTime, address, mapPokemon.Latitude, mapPokemon.Longitude }); pokemonMarker.ToolTip.Font = new Font("Arial", 12, GraphicsUnit.Pixel); pokemonMarker.ToolTipMode = MarkerTooltipMode.OnMouseOver; _pokemonMarks.Add(mapPokemon.SpawnPointId, pokemonMarker); _pokemonOverlay.Markers.Add(pokemonMarker); } })); }
public void Terkep_MegnyitasaIranyitoszam(string place, string city) { PointLatLng temp = new PointLatLng(); gmap.MapProvider = OpenStreetMapProvider.Instance; GMaps.Instance.Mode = AccessMode.ServerOnly; gmap.ShowCenter = false; gmap.GetPositionByKeywords(place, out temp); GMapOverlay markers = new GMapOverlay("markers"); GMapMarker marker = new GMarkerGoogle( new PointLatLng(temp.Lat, temp.Lng), GMarkerGoogleType.blue_pushpin); marker.ToolTipText = city + "\n" + place.Substring(0, 4); marker.ToolTip.Fill = Brushes.Black; marker.ToolTip.Foreground = Brushes.White; marker.ToolTip.Stroke = Pens.Black; marker.ToolTip.TextPadding = new Size(20, 10); markers.Markers.Add(marker); gmap.Overlays.Add(markers); gmap.SetPositionByKeywords("Hungary"); }
private void Demo_Load(object sender, EventArgs e) { gmap.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance; GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly; // gmap.SetPositionByKeywords("Mexico Distrito Federal"); GMapOverlay markersOverlay = new GMapOverlay("markers"); GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(-25.969562, 32.585789), GMarkerGoogleType.green); markersOverlay.Markers.Add(marker); gmap.Overlays.Add(markersOverlay); GMapOverlay polyOverlay = new GMapOverlay("polygons"); List <PointLatLng> points = new List <PointLatLng>(); points.Add(new PointLatLng(-25.969562, 32.585789)); points.Add(new PointLatLng(-25.966205, 32.588171)); points.Add(new PointLatLng(-25.968134, 32.591647)); points.Add(new PointLatLng(-25.971684, 32.589759)); GMapPolygon polygon = new GMapPolygon(points, "mypolygon"); polygon.Fill = new SolidBrush(Color.FromArgb(50, Color.Red)); polygon.Stroke = new Pen(Color.Red, 1); polyOverlay.Polygons.Add(polygon); gmap.Overlays.Add(polyOverlay); gmap.Position = new PointLatLng(-25.969562, 32.585789); }
// GMapOverlay routeOverlay = new GMapOverlay("route"); //draw route // Gmap Load private void timer_GPS_Tick(object sender, EventArgs e) { /*mom location update*/ mommarkersOverlay.Clear(); GMarkerGoogle mommarker = new GMarkerGoogle(new PointLatLng(uav_list[1].lat, uav_list[1].lon), RotateImage(Image.FromFile("Drawing.png"), uav_list[1].heading)); mommarker.ToolTipText = "mom"; mommarker.ToolTipMode = MarkerTooltipMode.Always; //Text always on; mommarkersOverlay.Markers.Add(mommarker); gmap.Overlays.Add(mommarkersOverlay); //addmomRoute(); /*son location update*/ sonmarkersOverlay.Clear(); GMarkerGoogle sonmarker = new GMarkerGoogle(new PointLatLng(uav_list[2].lat, uav_list[2].lon), RotateImage(Image.FromFile("Drawing1.png"), uav_list[2].heading)); sonmarker.ToolTipText = "son"; sonmarker.ToolTipMode = MarkerTooltipMode.Always; //Text always on; sonmarkersOverlay.Markers.Add(sonmarker); gmap.Overlays.Add(sonmarkersOverlay); //addsonRoute(); }
private void ActualizarRecorrido_Load(object sender, EventArgs e) { dt = new DataTable(); dt.Columns.Add(new DataColumn("Nombre", typeof(String))); dt.Columns.Add(new DataColumn("Descripción", typeof(String))); dt.Columns.Add(new DataColumn("Número de Parada", typeof(int))); dt.Columns.Add(new DataColumn("Latitud", typeof(double))); dt.Columns.Add(new DataColumn("Longitud", typeof(double))); dt.Rows.Add("Epn", "Facultad de Sistemas", NumParada, LatInicial, LngInicial); dataGridView1.DataSource = dt; dataGridView1.Columns[1].Visible = false; dataGridView1.Columns[2].Visible = false; dataGridView1.Columns[3].Visible = false; dataGridView1.Columns[4].Visible = false; gMapControl1.DragButton = MouseButtons.Left; gMapControl1.CanDragMap = true; gMapControl1.MapProvider = GMapProviders.GoogleMap; gMapControl1.Position = new PointLatLng(LatInicial, LngInicial); gMapControl1.MinZoom = 0; gMapControl1.MaxZoom = 24; gMapControl1.Zoom = 9; gMapControl1.AutoScroll = true; //Marcador markerOverlay = new GMapOverlay("Marcador"); marker = new GMarkerGoogle(new PointLatLng(LatInicial, LngInicial), GMarkerGoogleType.blue); markerOverlay.Markers.Add(marker); /*ToolTip de Texto * marker.ToolTipMode = MarkerTooltipMode.Always; * marker.ToolTipText = string.Format("Nombre: {0}\n Descripción: {1} \n ", Nombre, Descripcion); */ //Agregar al mapa gMapControl1.Overlays.Add(markerOverlay); }
/// <summary> /// used to write a KML, update the Map view polygon, and update the row headers /// </summary> public void writeKML() { // quickadd is for when loading wps from eeprom or file, to prevent slow, loading times if (quickadd) return; // this is to share the current mission with the data tab pointlist = new List<PointLatLngAlt>(); fullpointlist.Clear(); Debug.WriteLine(DateTime.Now); try { if (objectsoverlay != null) // hasnt been created yet { objectsoverlay.Markers.Clear(); } // process and add home to the list string home; if (TXT_homealt.Text != "" && TXT_homelat.Text != "" && TXT_homelng.Text != "") { home = string.Format("{0},{1},{2}\r\n", TXT_homelng.Text, TXT_homelat.Text, TXT_DefaultAlt.Text); if (objectsoverlay != null) // during startup { pointlist.Add(new PointLatLngAlt(double.Parse(TXT_homelat.Text), double.Parse(TXT_homelng.Text), (int)double.Parse(TXT_homealt.Text), "H")); fullpointlist.Add(pointlist[pointlist.Count - 1]); addpolygonmarker("H", double.Parse(TXT_homelng.Text), double.Parse(TXT_homelat.Text), 0, null); } } else { home = ""; pointlist.Add(null); fullpointlist.Add(pointlist[pointlist.Count - 1]); } // setup for centerpoint calc etc. double avglat = 0; double avglong = 0; double maxlat = -180; double maxlong = -180; double minlat = 180; double minlong = 180; double homealt = 0; try { if (!String.IsNullOrEmpty(TXT_homealt.Text)) homealt = (int)double.Parse(TXT_homealt.Text); } catch { } //if ((altmode)CMB_altmode.SelectedValue == altmode.Absolute) //{ // homealt = 0; // for absolute we dont need to add homealt //} int usable = 0; updateRowNumbers(); long temp = Stopwatch.GetTimestamp(); string lookat = ""; for (int a = 0; a < Commands.Rows.Count - 0; a++) { try { if (Commands.Rows[a].Cells[Command.Index].Value.ToString().Contains("UNKNOWN")) continue; int command = (byte)(int)Enum.Parse(typeof(MAVLink.MAV_CMD), Commands.Rows[a].Cells[Command.Index].Value.ToString(), false); if (command < (byte)MAVLink.MAV_CMD.LAST && command != (byte)MAVLink.MAV_CMD.TAKEOFF && command != (byte)MAVLink.MAV_CMD.RETURN_TO_LAUNCH && command != (byte)MAVLink.MAV_CMD.CONTINUE_AND_CHANGE_ALT && command != (byte)MAVLink.MAV_CMD.GUIDED_ENABLE || command == (byte)MAVLink.MAV_CMD.DO_SET_ROI) { string cell2 = Commands.Rows[a].Cells[Alt.Index].Value.ToString(); // alt string cell3 = Commands.Rows[a].Cells[Lat.Index].Value.ToString(); // lat string cell4 = Commands.Rows[a].Cells[Lon.Index].Value.ToString(); // lng // land can be 0,0 or a lat,lng if (command == (byte)MAVLink.MAV_CMD.LAND && cell3 == "0" && cell4 == "0") continue; if (cell4 == "?" || cell3 == "?") continue; if (command == (byte)MAVLink.MAV_CMD.DO_SET_ROI) { pointlist.Add(new PointLatLngAlt(double.Parse(cell3), double.Parse(cell4), (int)double.Parse(cell2) + homealt, "ROI" + (a + 1)) { color = Color.Red }); // do set roi is not a nav command. so we dont route through it //fullpointlist.Add(pointlist[pointlist.Count - 1]); GMarkerGoogle m = new GMarkerGoogle(new PointLatLng(double.Parse(cell3), double.Parse(cell4)), GMarkerGoogleType.red); m.ToolTipMode = MarkerTooltipMode.Always; m.ToolTipText = (a + 1).ToString(); m.Tag = (a + 1).ToString(); GMapMarkerRect mBorders = new GMapMarkerRect(m.Position); { mBorders.InnerMarker = m; mBorders.Tag = "Dont draw line"; } // check for clear roi, and hide it if (m.Position.Lat != 0 && m.Position.Lng != 0) { // order matters objectsoverlay.Markers.Add(m); objectsoverlay.Markers.Add(mBorders); } } else if (command == (byte)MAVLink.MAV_CMD.LOITER_TIME || command == (byte)MAVLink.MAV_CMD.LOITER_TURNS || command == (byte)MAVLink.MAV_CMD.LOITER_UNLIM) { pointlist.Add(new PointLatLngAlt(double.Parse(cell3), double.Parse(cell4), (int)double.Parse(cell2) + homealt, (a + 1).ToString()) { color = Color.LightBlue }); fullpointlist.Add(pointlist[pointlist.Count - 1]); addpolygonmarker((a + 1).ToString(), double.Parse(cell4), double.Parse(cell3), (int)double.Parse(cell2), Color.LightBlue); } else if (command == (byte)MAVLink.MAV_CMD.SPLINE_WAYPOINT) { pointlist.Add(new PointLatLngAlt(double.Parse(cell3), double.Parse(cell4), (int)double.Parse(cell2) + homealt, (a + 1).ToString()) { Tag2 = "spline" }); fullpointlist.Add(pointlist[pointlist.Count - 1]); addpolygonmarker((a + 1).ToString(), double.Parse(cell4), double.Parse(cell3), (int)double.Parse(cell2), Color.Green); } else { pointlist.Add(new PointLatLngAlt(double.Parse(cell3), double.Parse(cell4), (int)double.Parse(cell2) + homealt, (a + 1).ToString())); fullpointlist.Add(pointlist[pointlist.Count - 1]); addpolygonmarker((a + 1).ToString(), double.Parse(cell4), double.Parse(cell3), (int)double.Parse(cell2), null); } avglong += double.Parse(Commands.Rows[a].Cells[Lon.Index].Value.ToString()); avglat += double.Parse(Commands.Rows[a].Cells[Lat.Index].Value.ToString()); usable++; maxlong = Math.Max(double.Parse(Commands.Rows[a].Cells[Lon.Index].Value.ToString()), maxlong); maxlat = Math.Max(double.Parse(Commands.Rows[a].Cells[Lat.Index].Value.ToString()), maxlat); minlong = Math.Min(double.Parse(Commands.Rows[a].Cells[Lon.Index].Value.ToString()), minlong); minlat = Math.Min(double.Parse(Commands.Rows[a].Cells[Lat.Index].Value.ToString()), minlat); Debug.WriteLine(temp - Stopwatch.GetTimestamp()); } else if (command == (byte)MAVLink.MAV_CMD.DO_JUMP) // fix do jumps into the future { pointlist.Add(null); int wpno = int.Parse(Commands.Rows[a].Cells[Param1.Index].Value.ToString()); int repeat = int.Parse(Commands.Rows[a].Cells[Param2.Index].Value.ToString()); List<PointLatLngAlt> list = new List<PointLatLngAlt>(); // cycle through reps for (int repno = repeat; repno > 0; repno--) { // cycle through wps for (int no = wpno; no <= a; no++) { if (pointlist[no] != null) list.Add(pointlist[no]); } } fullpointlist.AddRange(list); } else { pointlist.Add(null); } } catch (Exception e) { log.Info("writekml - bad wp data " + e); } } if (usable > 0) { avglat = avglat / usable; avglong = avglong / usable; double latdiff = maxlat - minlat; double longdiff = maxlong - minlong; float range = 4000; Locationwp loc1 = new Locationwp(); loc1.lat = (minlat); loc1.lng = (minlong); Locationwp loc2 = new Locationwp(); loc2.lat = (maxlat); loc2.lng = (maxlong); //double distance = getDistance(loc1, loc2); // same code as ardupilot double distance = 2000; if (usable > 1) { range = (float)(distance * 2); } else { range = 4000; } if (avglong != 0 && usable < 3) { // no autozoom lookat = "<LookAt> <longitude>" + (minlong + longdiff / 2).ToString(new CultureInfo("en-US")) + "</longitude> <latitude>" + (minlat + latdiff / 2).ToString(new CultureInfo("en-US")) + "</latitude> <range>" + range + "</range> </LookAt>"; //MainMap.ZoomAndCenterMarkers("objects"); //MainMap.Zoom -= 1; //MainMap_OnMapZoomChanged(); } } else if (home.Length > 5 && usable == 0) { lookat = "<LookAt> <longitude>" + TXT_homelng.Text.ToString(new CultureInfo("en-US")) + "</longitude> <latitude>" + TXT_homelat.Text.ToString(new CultureInfo("en-US")) + "</latitude> <range>4000</range> </LookAt>"; RectLatLng? rect = gMapControl1.GetRectOfAllMarkers("objects"); if (rect.HasValue) { gMapControl1.Position = rect.Value.LocationMiddle; } //MainMap.Zoom = 17; //MainMap_OnMapZoomChanged(); } //RegeneratePolygon(); RegenerateWPRoute(fullpointlist); if (fullpointlist.Count > 0) { double homedist = 0; if (home.Length > 5) { homedist = gMapControl1.MapProvider.Projection.GetDistance(fullpointlist[fullpointlist.Count - 1], fullpointlist[0]); } double dist = 0; for (int a = 1; a < fullpointlist.Count; a++) { if (fullpointlist[a - 1] == null) continue; if (fullpointlist[a] == null) continue; dist += gMapControl1.MapProvider.Projection.GetDistance(fullpointlist[a - 1], fullpointlist[a]); } //lbl_distance.Text = rm.GetString("lbl_distance.Text") + ": " + FormatDistance(dist + homedist, false); } setgradanddistandaz(); } catch (Exception ex) { log.Info(ex.ToString()); } Debug.WriteLine(DateTime.Now); }
public void addPathMarker(PointLatLng point) { if (lPointsPath.Count == 1) { //adds a marker to the begginging of the path GMarkerGoogle newMarker = new GMarkerGoogle(point, GMarkerGoogleType.green); MarkerOverlay.Markers.Add(newMarker); } else if (lPointsPath.Count > 2) { //adds markers to each point on the path except the first //leaves most recent point empty in case the path is ended there and the ending marker needs to be placed GMarkerGoogle newMarker = new GMarkerGoogle(lPointsPath[lPointsPath.Count - 2], GMarkerGoogleType.gray_small); MarkerOverlay.Markers.Add(newMarker); } }
private void btnPathEnd_Click(object sender, EventArgs e) { endPath(); //adds marker to end of path if (lPointsPath.Count > 0) { GMarkerGoogle newMarker = new GMarkerGoogle(lPointsPath.Last<PointLatLng>(), GMarkerGoogleType.red); MarkerOverlay.Markers.Add(newMarker); } }
public void addPathMarkers() { GMarkerGoogle newMarker = new GMarkerGoogle(lPointsPath[0], GMarkerGoogleType.green); MarkerOverlay.Markers.Add(newMarker); for (int i = 1; i < lPointsPath.Count - 1; i++) { newMarker = new GMarkerGoogle(lPointsPath[i], GMarkerGoogleType.gray_small); MarkerOverlay.Markers.Add(newMarker); } newMarker = new GMarkerGoogle(lPointsPath[lPointsPath.Count - 1], GMarkerGoogleType.red); MarkerOverlay.Markers.Add(newMarker); }
/// <summary> /// find nearest exhanger from current mouse position /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void findNearestToolStripMenuItem_Click(object sender, EventArgs e) { PointLatLng objPosition = GetCursorPosition(); using(var objProvider = new BankProvider()) { List<CurrencyExchanger> objExchangers = new List<CurrencyExchanger>(); foreach (var marker in objMarkersOverlay.Markers) { CurrencyExchanger exchanger = objProvider.GetExchangerById((int)marker.Tag); if (exchanger != null) { objExchangers.Add(exchanger); } } CurrencyExchanger objNearestExchanger = objProvider.GetNearestExchanger(objPosition.Lat, objPosition.Lng, objExchangers); var objMarker = new GMarkerGoogle(new PointLatLng(objNearestExchanger.X, objNearestExchanger.Y), GMarkerGoogleType.blue); objMarker.Tag = objNearestExchanger.Id; gMapControl1.UpdateMarkerLocalPosition(objMarker); var markersOverlay = new GMapOverlay(); markersOverlay.Markers.Add(objMarker); gMapControl1.Overlays.Add(markersOverlay); } }
private void UpdateMap() { synchronizationContext.Post(new SendOrPostCallback(o => { pokestopsOverlay.Markers.Clear(); List<PointLatLng> routePoint = new List<PointLatLng>(); foreach (var pokeStop in pokeStops) { GMarkerGoogleType type = GMarkerGoogleType.blue_small; if (pokeStop.CooldownCompleteTimestampMs > DateTime.UtcNow.ToUnixTime()) { type = GMarkerGoogleType.gray_small; } var pokeStopLoc = new PointLatLng(pokeStop.Latitude, pokeStop.Longitude); var pokestopMarker = new GMarkerGoogle(pokeStopLoc, type); //pokestopMarker.ToolTipMode = MarkerTooltipMode.OnMouseOver; //pokestopMarker.ToolTip = new GMapBaloonToolTip(pokestopMarker); pokestopsOverlay.Markers.Add(pokestopMarker); routePoint.Add(pokeStopLoc); } pokestopsOverlay.Routes.Clear(); pokestopsOverlay.Routes.Add(new GMapRoute(routePoint, "Walking Path")); pokemonsOverlay.Markers.Clear(); if (wildPokemons != null) { foreach (var pokemon in wildPokemons) { var pokemonMarker = new GMarkerGoogle(new PointLatLng(pokemon.Latitude, pokemon.Longitude), GMarkerGoogleType.red_small); pokemonsOverlay.Markers.Add(pokemonMarker); } } searchAreaOverlay.Polygons.Clear(); S2GMapDrawer.DrawS2Cells(S2Helper.GetNearbyCellIds(ClientSettings.DefaultLongitude, ClientSettings.DefaultLatitude), searchAreaOverlay); }), null); }
//Events that would occur during the selection of a location private void selectRegion_SelectedIndexChanged(object sender, EventArgs e) { //When the Brisbane region is selected the form will display all related information //regarding that location selectedRegion = (string)selectRegion.SelectedItem; selectedRegion = (string)selectRegion.SelectedItem; if (selectedRegion == BRISBANE) { regionNamelabel.Text = BRISBANE; locationNamelabel.Text = BRISBANE; statusText.Text = "No Disaster"; statusText.ForeColor = Color.Black; statusText.Visible = true; // Set the API Map interface on Brisbane gmap.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance; GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly; gmap.Position = new PointLatLng(-27.4710107, 153.0234489); //gmap.SetPositionByKeywords("Brisbane, Australia"); // Set a marker on the location GMapOverlay markersOverlay = new GMapOverlay("markers"); GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(-27.4710107, 153.0234489), GMarkerGoogleType.green); markersOverlay.Markers.Add(marker); gmap.Overlays.Add(markersOverlay); //Set all information regarding the Gold Coast when selected in the combo box } else if (selectedRegion == GOLD_COAST) { regionNamelabel.Text = "Southern Eastern"; locationNamelabel.Text = "Gold Coast"; statusText.Text = "Tsunami"; statusText.Visible = true; statusText.ForeColor = Color.Red; //Set the API Map to the Gold Coast Location gmap.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance; GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly; gmap.Position = new PointLatLng(-28.0172605, 153.4256987); //gmap.SetPositionByKeywords("Brisbane, Australia"); //Place a marker at the location GMapOverlay markersOverlay = new GMapOverlay("markers"); GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(-28.0172605, 153.4256987), GMarkerGoogleType.red); markersOverlay.Markers.Add(marker); gmap.Overlays.Add(markersOverlay); } else if (selectedRegion == SUNSHINE_COAST) { regionNamelabel.Text = "Southern Eastern"; locationNamelabel.Text = "Sunshine Coast"; statusText.Text = "Fire"; statusText.Visible = true; statusText.ForeColor = Color.Red; //Set the API Map to the sunshine coast Location gmap.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance; GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly; gmap.Position = new PointLatLng(-26.60, 153.001); //gmap.SetPositionByKeywords("sunshine coast Australia"); //Place a marker at the location GMapOverlay markersOverlay = new GMapOverlay("markers"); GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(-26.0172605, 152.7), GMarkerGoogleType.red); markersOverlay.Markers.Add(marker); gmap.Overlays.Add(markersOverlay); } else if (selectedRegion == TOWNSVILLE) { regionNamelabel.Text = "TOWNSVILLE"; locationNamelabel.Text = "Townsville"; statusText.Text = "no disaster"; statusText.Visible = true; statusText.ForeColor = Color.Black; //Set the API Map to the Townsville gmap.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance; GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly; gmap.Position = new PointLatLng(-19.50, 146.49); //gmap.SetPositionByKeywords("Brisbane, Australia"); //Place a marker at the location GMapOverlay markersOverlay = new GMapOverlay("markers"); GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(-19.48, 146.50), GMarkerGoogleType.red); markersOverlay.Markers.Add(marker); gmap.Overlays.Add(markersOverlay); } else if (selectedRegion == CARINS_COAST) { regionNamelabel.Text = "FAR NORTH"; locationNamelabel.Text = "CARINS_COAST"; statusText.Text = "no disaster"; statusText.Visible = true; statusText.ForeColor = Color.Black; //Set the API Map to the cairns gmap.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance; GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly; gmap.Position = new PointLatLng(-16.5532, 145.4631); //gmap.SetPositionByKeywords("Brisbane, Australia"); //Place a marker at the location GMapOverlay markersOverlay = new GMapOverlay("markers"); GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(-16.5532, 145.4631), GMarkerGoogleType.red); markersOverlay.Markers.Add(marker); gmap.Overlays.Add(markersOverlay); } else if (selectedRegion == ROCKHAMPTON) { regionNamelabel.Text = "ROCKHAMPTON"; locationNamelabel.Text = "ROCKHAMPTON"; statusText.Text = "no disaster"; statusText.Visible = true; statusText.ForeColor = Color.Black; //Set the API Map to the ROCKHAMPTON gmap.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance; GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly; gmap.Position = new PointLatLng(-23.225, 150.307); //gmap.SetPositionByKeywords("ROCKHAMPTON area, Australia"); //Place a marker at the location GMapOverlay markersOverlay = new GMapOverlay("markers"); GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(-23.225, 150.307), GMarkerGoogleType.red); markersOverlay.Markers.Add(marker); gmap.Overlays.Add(markersOverlay); } else if (selectedRegion == MOUNT_ISA) { regionNamelabel.Text = "Mount ISA"; locationNamelabel.Text = "MOUNT_ISA"; statusText.Text = "no disaster"; statusText.Visible = true; statusText.ForeColor = Color.Black; //Set the API Map to the Mount Isa gmap.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance; GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly; gmap.Position = new PointLatLng(-20.44, 139.30); //gmap.SetPositionByKeywords("Mount Isa, Australia"); //Place a marker at the location GMapOverlay markersOverlay = new GMapOverlay("markers"); GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(-20.44, 139.30), GMarkerGoogleType.red); markersOverlay.Markers.Add(marker); gmap.Overlays.Add(markersOverlay); } else if (selectedRegion == MACKAY) { regionNamelabel.Text = "MACKAY"; locationNamelabel.Text = "Mackay"; statusText.Text = "no disaster"; statusText.Visible = true; statusText.ForeColor = Color.Black; //Set the API Map to the mackay gmap.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance; GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly; gmap.Position = new PointLatLng(-21.0828, 149.1110); //gmap.SetPositionByKeywords("Brisbane, Australia"); //Place a marker at the location GMapOverlay markersOverlay = new GMapOverlay("markers"); GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(-21.0828, 149.1110), GMarkerGoogleType.green); markersOverlay.Markers.Add(marker); gmap.Overlays.Add(markersOverlay); } else if (selectedRegion == CENTRAL_WEST) { regionNamelabel.Text = "CENTRAL_WEST"; locationNamelabel.Text = "CENTRAL_WEST"; statusText.Text = "no disaster"; statusText.Visible = true; statusText.ForeColor = Color.Black; //Set the API Map to the longereach gmap.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance; GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly; gmap.Position = new PointLatLng(-23.27, 144.15); //gmap.SetPositionByKeywords("longreach, Australia"); //Place a marker at the location GMapOverlay markersOverlay = new GMapOverlay("markers"); GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(-23.27, 144.15), GMarkerGoogleType.green); markersOverlay.Markers.Add(marker); gmap.Overlays.Add(markersOverlay); } else if (selectedRegion == SOUTH_WEST) { regionNamelabel.Text = "SOUTH_WEST"; locationNamelabel.Text = "SOUTH_WEST"; statusText.Text = "no disaster"; statusText.Visible = true; statusText.ForeColor = Color.Black; //Set the API Map to the SOUTH_WEST gmap.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance; GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly; gmap.Position = new PointLatLng(-26.33, 148.48); //gmap.SetPositionByKeywords("Roma, Australia"); //Place a marker at the location GMapOverlay markersOverlay = new GMapOverlay("markers"); GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(-20.44, 139.30), GMarkerGoogleType.green); markersOverlay.Markers.Add(marker); gmap.Overlays.Add(markersOverlay); } else if (selectedRegion == GLADSTONE) { regionNamelabel.Text = "GLADSTONE"; locationNamelabel.Text = "Townsville"; statusText.Text = "no disaster"; statusText.Visible = true; statusText.ForeColor = Color.Black; //Set the API Map to the Townsville gmap.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance; GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly; gmap.Position = new PointLatLng(-23.5056, 151.1547); //gmap.SetPositionByKeywords("Brisbane, Australia"); //Place a marker at the location GMapOverlay markersOverlay = new GMapOverlay("markers"); GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(-23.5056, 151.1547), GMarkerGoogleType.green); markersOverlay.Markers.Add(marker); gmap.Overlays.Add(markersOverlay); } else if (selectedRegion == WIDE_BAY) { regionNamelabel.Text = "Southern Eastern"; locationNamelabel.Text = "WIDE_BAY"; statusText.Text = "no disaster"; statusText.Visible = true; statusText.ForeColor = Color.Black; //Set the API Map to the Townsville gmap.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance; GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly; gmap.Position = new PointLatLng(-24.51, 152.21); //gmap.SetPositionByKeywords("Brisbane, Australia"); //Place a marker at the location GMapOverlay markersOverlay = new GMapOverlay("markers"); GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(-24.51, 152.21), GMarkerGoogleType.red); markersOverlay.Markers.Add(marker); gmap.Overlays.Add(markersOverlay); } }
private void GoToSample(int SampleID, bool movemap, bool movegraph, bool movegrid) { bool zoomgraph = false; m_currSampleID = SampleID; markeroverlay.Markers.Clear(); PointLatLng pt1; if (GetGPSFromRow(SampleID, out pt1)) { MissionPlanner.Utilities.PointLatLngAlt pt3 = new MissionPlanner.Utilities.PointLatLngAlt(pt1); GMapMarker pos3 = new GMarkerGoogle(pt3, GMarkerGoogleType.pink_dot); markeroverlay.Markers.Add(pos3); } if (movemap) { myGMAP1.Position = pt1; } //move the graph "cursor" if (m_cursorLine != null) { zg1.GraphPane.GraphObjList.Remove(m_cursorLine); } m_cursorLine = new LineObj(Color.Black, SampleID, 0, SampleID, 1); m_cursorLine.Location.CoordinateFrame = CoordType.XScaleYChartFraction; // This do the trick ! m_cursorLine.IsClippedToChartRect = true; m_cursorLine.Line.Style = System.Drawing.Drawing2D.DashStyle.Dash; m_cursorLine.Line.Width = 2f; m_cursorLine.Line.Color = Color.LightGray; m_cursorLine.ZOrder = ZOrder.E_BehindCurves; zg1.GraphPane.GraphObjList.Add(m_cursorLine); if (movegraph) { double delta = zg1.GraphPane.XAxis.Scale.Max - zg1.GraphPane.XAxis.Scale.Min; if (zoomgraph) { delta = 2 * 60.0 / 20; delta = Math.Max(100, delta); } zg1.GraphPane.XAxis.Scale.Min = SampleID - delta / 2; zg1.GraphPane.XAxis.Scale.Max = SampleID + delta / 2; zg1.AxisChange(); } zg1.Invalidate(); if (movegrid) { try { scrollGrid(dataGridView1, SampleID); dataGridView1.CurrentCell = dataGridView1.Rows[SampleID].Cells[1]; dataGridView1.ClearSelection(); dataGridView1.Rows[(int)SampleID].Selected = true; dataGridView1.Rows[(int)SampleID].Cells[1].Selected = true; } catch { } } }
public mainGUI() { InitializeComponent(); #region map_setup // config map MainMap.MinZoom = 1; MainMap.MaxZoom = 20; MainMap.CacheLocation = Path.GetDirectoryName(Application.ExecutablePath) + "/mapcache/"; mapProviders = new GMapProvider[7]; mapProviders[0] = GMapProviders.BingHybridMap; mapProviders[1] = GMapProviders.BingSatelliteMap; mapProviders[2] = GMapProviders.GoogleSatelliteMap; mapProviders[3] = GMapProviders.GoogleHybridMap; mapProviders[4] = GMapProviders.OviSatelliteMap; mapProviders[5] = GMapProviders.OviHybridMap; for (int i = 0; i < 6; i++) { cbMapProviders.Items.Add(mapProviders[i]); } // map events MainMap.OnPositionChanged += new PositionChanged(MainMap_OnCurrentPositionChanged); //MainMap.OnMarkerClick += new MarkerClick(MainMap_OnMarkerClick); MainMap.OnMapZoomChanged += new MapZoomChanged(MainMap_OnMapZoomChanged); MainMap.MouseMove += new MouseEventHandler(MainMap_MouseMove); MainMap.MouseDown += new MouseEventHandler(MainMap_MouseDown); MainMap.MouseUp += new MouseEventHandler(MainMap_MouseUp); MainMap.OnMarkerEnter += new MarkerEnter(MainMap_OnMarkerEnter); MainMap.OnMarkerLeave += new MarkerLeave(MainMap_OnMarkerLeave); currentMarker = new GMarkerGoogle(MainMap.Position,GMarkerGoogleType.red); //MainMap.MapScaleInfoEnabled = true; MainMap.ForceDoubleBuffer = true; MainMap.Manager.Mode = AccessMode.ServerAndCache; MainMap.Position = copterPos; Pen penRoute = new Pen(Color.Yellow, 3); Pen penScale = new Pen(Color.Blue, 3); MainMap.ScalePen = penScale; GMOverlayFlightPath = new GMapOverlay("flightpath"); MainMap.Overlays.Add(GMOverlayFlightPath); GMOverlayMission = new GMapOverlay("missionroute"); MainMap.Overlays.Add(GMOverlayMission); GMOverlayWaypoints = new GMapOverlay("waypoints"); MainMap.Overlays.Add(GMOverlayWaypoints); GMOverlayLiveData = new GMapOverlay("livedata"); MainMap.Overlays.Add(GMOverlayLiveData); GMOverlayPOI = new GMapOverlay("poi"); MainMap.Overlays.Add(GMOverlayPOI); GMOverlayLiveData.Markers.Clear(); GMOverlayLiveData.Markers.Add(new GMapMarkerCopter(copterPos, 0, 0, 0, 3)); GMRouteFlightPath = new GMapRoute(points, "flightpath"); GMRouteFlightPath.Stroke = penRoute; GMOverlayFlightPath.Routes.Add(GMRouteFlightPath); center = new GMarkerGoogle(MainMap.Position,GMarkerGoogleType.blue_dot); //center = new GMapMarkerCross(MainMap.Position); MainMap.Invalidate(false); //MainMap.Refresh(); #endregion }
private void pictureBox2_Click(object sender, EventArgs e) { //Drop a Waypoint Marker at a random location on campus //Generate a very smalll double to add randomness to our waypoints //var r = new Random(); //double randomLat = 43.389758 + 0.0001 * r.Next(100); //double randomLon = -80.405068 + 0.0001 * r.Next(100); List<ParseObject> coor = coordinate.ToList(); //shoot the waypoint on the screen for (int i = 0; i < coordinate.Count(); i++) { Double randomLat = coor[i].Get<Double>("latitud"); Double randomLon = coor[i].Get<Double>("longtitude"); //Create waypoint location and style GMarkerGoogle marker = new GMarkerGoogle(new GMap.NET.PointLatLng (randomLat, randomLon), GMarkerGoogleType.yellow_dot); //add waypoint to the transparent overlay markerOverlay.Markers.Add(marker); //add the overlay to the gMapControl1.Overlays.Add(markerOverlay); } }
private void addpolygonmarker(string tag, double lng, double lat, int alt, Color? color, GMapOverlay overlay) { try { PointLatLng point = new PointLatLng(lat, lng); GMarkerGoogle m = new GMarkerGoogle(point, GMarkerGoogleType.green); m.ToolTipMode = MarkerTooltipMode.Always; m.ToolTipText = tag; m.Tag = tag; GMapMarkerRect mBorders = new GMapMarkerRect(point); { mBorders.InnerMarker = m; try { mBorders.wprad = (int) (Settings.Instance.GetFloat("TXT_WPRad")/CurrentState.multiplierdist); } catch { } if (color.HasValue) { mBorders.Color = color.Value; } } Invoke((MethodInvoker) delegate { overlay.Markers.Add(m); overlay.Markers.Add(mBorders); }); } catch (Exception) { } }
private void addpolygonmarker(string tag, double lng, double lat, int alt, Color? color, GMapOverlay overlay) { try { PointLatLng point = new PointLatLng(lat, lng); GMarkerGoogle m = new GMarkerGoogle(point, GMarkerGoogleType.green); m.ToolTipMode = MarkerTooltipMode.Always; m.ToolTipText = tag; m.Tag = tag; GMapMarkerRect mBorders = new GMapMarkerRect(point); { mBorders.InnerMarker = m; try { mBorders.wprad = (int) (float.Parse(MainV2.config["TXT_WPRad"].ToString())/CurrentState.multiplierdist); } catch { } if (color.HasValue) { mBorders.Color = color.Value; } } overlay.Markers.Add(m); overlay.Markers.Add(mBorders); } catch (Exception) { } }
private void addpolygonmarkergrid(string tag, double lng, double lat, int alt) { try { PointLatLng point = new PointLatLng(lat, lng); GMarkerGoogle m = new GMarkerGoogle(point, GMarkerGoogleType.red); m.ToolTipMode = MarkerTooltipMode.Never; m.ToolTipText = "grid" + tag; m.Tag = "grid" + tag; //MissionPlanner.GMapMarkerRectWPRad mBorders = new MissionPlanner.GMapMarkerRectWPRad(point, (int)float.Parse(TXT_WPRad.Text), MainMap); GMapMarkerRect mBorders = new GMapMarkerRect(point); { mBorders.InnerMarker = m; } drawnpolygonsoverlay.Markers.Add(m); drawnpolygonsoverlay.Markers.Add(mBorders); } catch (Exception ex) { log.Info(ex.ToString()); } }
/// <summary> /// Show exchangers with best sell price /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void radioButton2_CheckedChanged(object sender, EventArgs e) { try { using(var objProvider = new BankProvider()) { List<ExchangeRate> objBestSellRates = new List<ExchangeRate>(); objBestSellRates.Add(objProvider.GetBestSellRate("USD")); objBestSellRates.Add(objProvider.GetBestSellRate("EUR")); objBestSellRates.Add(objProvider.GetBestSellRate("RUR")); List<CurrencyExchanger> objExchangers = new List<CurrencyExchanger>(); foreach(var rate in objBestSellRates) { objExchangers.AddRange(objProvider.DataBase.CurrencyExchangers.Where(ce => ce.Bank.Id == rate.Bank.Id).ToArray()); } objMarkersOverlay = new GMapOverlay(); foreach(var exchanger in objExchangers) { var objMarker = new GMarkerGoogle(new PointLatLng(exchanger.X, exchanger.Y), GMarkerGoogleType.green) { Tag = exchanger.Id, ToolTipText = String.Format("{0} office:{1}\nBuy\nUSD {2}\nEUR {3}\nRUR {4}", exchanger.Bank.Name, exchanger.Number, objBestSellRates[0].Buy, objBestSellRates[1].Buy, objBestSellRates[2].Buy ) }; gMapControl1.UpdateMarkerLocalPosition(objMarker); objMarkersOverlay.Markers.Add(objMarker); } gMapControl1.Overlays.Clear(); gMapControl1.Overlays.Add(objMarkersOverlay); } } catch(Exception ex) { MessageBox.Show(ex.Message); } }
private void addpolygonmarkerred(string tag, double lng, double lat, int alt, Color? color, GMapOverlay overlay) { try { PointLatLng point = new PointLatLng(lat, lng); GMarkerGoogle m = new GMarkerGoogle(point, GMarkerGoogleType.red); m.ToolTipMode = MarkerTooltipMode.Always; m.ToolTipText = tag; m.Tag = tag; GMapMarkerRect mBorders = new GMapMarkerRect(point); { mBorders.InnerMarker = m; } overlay.Markers.Add(m); overlay.Markers.Add(mBorders); } catch (Exception) { } }
/// <summary> /// draw all CurrencyExchangers markers on map /// </summary> private void DrawMarkers() { try { using(var objProvider = new BankProvider()) { objMarkersOverlay.Clear(); List<CurrencyExchanger> objExchangers = objProvider.GetAllExchangers(); foreach(var exchanger in objExchangers) { ExchangeRate objUsd = objProvider.GetRateByBank("USD", exchanger.Bank); ExchangeRate objEur = objProvider.GetRateByBank("EUR", exchanger.Bank); ExchangeRate objRur = objProvider.GetRateByBank("RUR", exchanger.Bank); var objMarker = new GMarkerGoogle(new PointLatLng(exchanger.X, exchanger.Y), GMarkerGoogleType.yellow) { ToolTipText = String.Format( "{0} office:{1}\nBuy\n" + "USD:{2}\nEUR:{3}\nRUR:{4}\n" + "Sell\n" + "USD:{5}\nEUR:{6}\nRUR:{7}", exchanger.Bank.Name, exchanger.Number, objUsd.Buy, objEur.Buy, objRur.Buy, objUsd.Sale, objEur.Sale, objRur.Sale ), Tag = exchanger.Id }; objMarkersOverlay.Markers.Add(objMarker); gMapControl1.UpdateMarkerLocalPosition(objMarker); } } gMapControl1.Overlays.Clear(); gMapControl1.Overlays.Add(objMarkersOverlay); } catch(Exception ex) { MessageBox.Show(ex.Message); } }