public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { string imageId = value as string; var image = new Bitmap(80, 20); if (parameter != null) { string strParameter = parameter.ToString(); float fontSize = float.Parse(strParameter); ModuleGlobeSpotter globeSpotter = ModuleGlobeSpotter.Current; ViewerList viewerList = globeSpotter.ViewerList; Viewer thisViewer = viewerList.Get(imageId); Color color = thisViewer?.Color ?? Color.Gray; Brush brush = new SolidBrush(Color.FromArgb(255, color)); using (var sf = new StringFormat()) { using (var ga = Graphics.FromImage(image)) { ga.Clear(Color.Transparent); Rectangle rectangle = new Rectangle(2, 2, 76, 16); ga.DrawRectangle(new Pen(Brushes.Black, 1), rectangle); ga.FillRectangle(brush, rectangle); sf.Alignment = StringAlignment.Center; Font font = new Font("Arial", fontSize); ga.DrawString(imageId, font, Brushes.Black, rectangle, sf); } } } return(image.ToBitmapSource()); }
public MeasurementObservation(MeasurementPoint measurementPoint, string imageId, MapPoint observationPoint, Bitmap match, double xDir, double yDir) { XDir = xDir; YDir = yDir; _measurementPoint = measurementPoint; ImageId = imageId; Point = observationPoint; Match = match; GlobeSpotter globeSpotter = GlobeSpotter.Current; ViewerList viewerList = globeSpotter.ViewerList; Viewer = viewerList.Get(imageId); // event listeners _measurementPoint.PropertyChanged += OnPropertyMeasurementPointChanged; PropertyChanged += OnPropertyMeasurementObservationChanged; MapViewCameraChangedEvent.Subscribe(OnMapViewCameraChanged); viewerList.ViewerAdded += OnViewerAdded; viewerList.ViewerRemoved += OnViewerRemoved; viewerList.ViewerMoved += OnViewerMoved; }
public void OnImageChanged(uint viewerId) { Viewer viewer = _viewerList.Get(viewerId); if ((viewer != null) && (_api != null)) { string imageId = _api.GetImageID(viewerId); viewer.ImageId = imageId; if (viewer.HasMarker) { viewer.HasMarker = false; List <Viewer> markerViewers = _viewerList.MarkerViewers; if (markerViewers.Count == 0 && _crossCheck != null) { _crossCheck.Dispose(); _crossCheck = null; } } } }