private void bgwShowImage_DoWork(object sender, DoWorkEventArgs e) { PointLatLng pos = gMap.Position; int progress = 0; OverlayPhotosWGS.Markers.Clear(); OverlayPhotosMAR.Markers.Clear(); foreach (KeyValuePair <Image, string> img in photos) { using (Image photo = new Bitmap(img.Value)) { pos.Lat = EXIF.GetLatitude(photo); pos.Lng = EXIF.GetLongitude(photo); photo.Dispose(); } if (double.IsNaN(pos.Lat) || double.IsNaN(pos.Lng)) { continue; } double lat = pos.Lat, lng = pos.Lng; PosShift.Convert2Mars(pos.Lng, pos.Lat, out lng, out lat); GMarkerGoogle marker_wgs = new GMarkerGoogle(pos, GMarkerGoogleType.green_dot); GMapImageToolTip tooltip_wgs = new GMapImageToolTip(marker_wgs); tooltip_wgs.Image = img.Key; tooltip_wgs.Offset = new Point(0, -12); tooltip_wgs.Font = new Font("Segoe UI", 8); tooltip_wgs.Stroke = new System.Drawing.Pen(System.Drawing.Color.LightCoral, 2); tooltip_wgs.Fill = new SolidBrush(System.Drawing.Color.Snow); marker_wgs.ToolTip = tooltip_wgs; marker_wgs.ToolTipText = Path.GetFileName(img.Value); marker_wgs.Tag = pos; OverlayPhotosWGS.Markers.Add(marker_wgs); GMarkerGoogle marker_mar = new GMarkerGoogle(new PointLatLng(lat, lng), GMarkerGoogleType.green_dot); GMapImageToolTip tooltip_mar = new GMapImageToolTip(marker_mar); tooltip_mar.Image = img.Key; tooltip_mar.Offset = new Point(0, -12); tooltip_mar.Font = new Font("Segoe UI", 8); tooltip_mar.Stroke = new System.Drawing.Pen(System.Drawing.Color.SlateBlue, 2); tooltip_mar.Fill = new SolidBrush(System.Drawing.Color.Snow); marker_mar.ToolTip = tooltip_mar; marker_mar.ToolTipText = Path.GetFileName(img.Value); marker_mar.Tag = new PointLatLng(lat, lng); OverlayPhotosMAR.Markers.Add(marker_mar); progress++; if (bgwShowImage.IsBusy) { bgwShowImage.ReportProgress(progress); } } }
private void picGeoRef_DragDrop(object sender, DragEventArgs e) { PointLatLng pos = gMap.Position; string[] flist = (string[])e.Data.GetData(DataFormats.FileDrop, true); picGeoRef.Load(flist[0]); pos.Lat = EXIF.GetLatitude(picGeoRef.Image, pos.Lat); pos.Lng = EXIF.GetLongitude(picGeoRef.Image, pos.Lng); double lat = pos.Lat, lng = pos.Lng; PosShift.Convert2Mars(pos.Lng, pos.Lat, out lng, out lat); OverlayRefPosWGS.Markers.Clear(); //OverlayRefPosWGS.Markers.Add( new GMarkerGoogle( pos, GMarkerGoogleType.blue_pushpin ) ); //OverlayRefPosWGS.Markers.Add( new GMarkerGoogle( pos, getPhotoThumb( picGeoRef.Image ) ) ); GMarkerGoogle marker_wgs = new GMarkerGoogle(pos, GMarkerGoogleType.lightblue_dot); marker_wgs.ToolTip = new GMapBaloonToolTip(marker_wgs); marker_wgs.ToolTip.Stroke = new System.Drawing.Pen(System.Drawing.Color.Violet); marker_wgs.ToolTip.Fill = new SolidBrush(System.Drawing.Color.Snow); //marker.ToolTipText = "<html><body><img src=\"./P4083508.jpg\" /></body></html>"; marker_wgs.ToolTipText = Path.GetFileName(flist[0]); OverlayRefPosWGS.Markers.Add(marker_wgs); OverlayRefPosMAR.Markers.Clear(); //OverlayRefPosMAR.Markers.Add( new GMarkerGoogle( new PointLatLng(lat, lng), GMarkerGoogleType.blue_pushpin ) ); //OverlayRefPosMAR.Markers.Add( new GMarkerGoogle( new PointLatLng( lat, lng ), getPhotoThumb( picGeoRef.Image ) ) ); GMarkerGoogle marker_mar = new GMarkerGoogle(new PointLatLng(lat, lng), GMarkerGoogleType.orange_dot); marker_mar.ToolTip = new GMapBaloonToolTip(marker_mar); marker_mar.ToolTip.Stroke = new System.Drawing.Pen(System.Drawing.Color.SlateBlue); marker_mar.ToolTip.Fill = new SolidBrush(System.Drawing.Color.Snow); //markermar.ToolTipText = "<html><body><img src=\"./P4083508.jpg\" /></body></html>"; marker_mar.ToolTipText = Path.GetFileName(flist[0]); OverlayRefPosMAR.Markers.Add(marker_mar); //gMap.Zoom = 12; updatePositions(OverlayRefPos, true); }
public void ShowImage(KeyValuePair <Image, string> img) { PointLatLng pos = gMap.Position; Image photo = new Bitmap(img.Value); pos.Lat = EXIF.GetLatitude(photo); pos.Lng = EXIF.GetLongitude(photo); photo.Dispose(); if (double.IsNaN(pos.Lat) || double.IsNaN(pos.Lng)) { return; } double lat = pos.Lat, lng = pos.Lng; PosShift.Convert2Mars(pos.Lng, pos.Lat, out lng, out lat); OverlayRefPosWGS.Markers.Clear(); GMarkerGoogle marker_wgs = new GMarkerGoogle(pos, GMarkerGoogleType.pink_dot); marker_wgs.ToolTip = new GMapBaloonToolTip(marker_wgs); marker_wgs.ToolTip.Stroke = new System.Drawing.Pen(System.Drawing.Color.Violet); marker_wgs.ToolTip.Fill = new SolidBrush(System.Drawing.Color.Snow); //new SolidBrush(Color.WhiteSmoke); marker_wgs.ToolTipText = Path.GetFileName(img.Value); OverlayRefPosWGS.Markers.Add(marker_wgs); OverlayRefPosMAR.Markers.Clear(); GMarkerGoogle marker_mar = new GMarkerGoogle(new PointLatLng(lat, lng), GMarkerGoogleType.pink_dot); marker_mar.ToolTip = new GMapBaloonToolTip(marker_mar); marker_mar.ToolTip.Stroke = new System.Drawing.Pen(System.Drawing.Color.SlateBlue); marker_mar.ToolTip.Fill = new SolidBrush(System.Drawing.Color.Snow); marker_mar.ToolTipText = Path.GetFileName(img.Value); OverlayRefPosMAR.Markers.Add(marker_mar); updatePositions(OverlayPhotos, true); }