private void CreateStaticExtraDrawings() { // Add the static extra drawings. // These drawings are unique and not attached to any particular key image. spotlightManager = new SpotlightManager(); autoNumberManager = new AutoNumberManager(ToolManager.GetStylePreset("AutoNumbers")); drawingCoordinateSystem = new DrawingCoordinateSystem(Point.Empty, ToolManager.GetStylePreset("CoordinateSystem")); drawingTestGrid = new DrawingTestGrid(); extraDrawings.Add(spotlightManager); extraDrawings.Add(autoNumberManager); extraDrawings.Add(drawingCoordinateSystem); extraDrawings.Add(drawingTestGrid); // totalStaticExtraDrawings is used to differenciate between static extra drawings like multidrawing managers // and dynamic extra drawings like tracks and chronos. totalStaticExtraDrawings = extraDrawings.Count; spotlightManager.TrackableDrawingAdded += (s, e) => { if (AddTrackableDrawingCommand != null) { AddTrackableDrawingCommand.Execute(e.TrackableDrawing); } }; spotlightManager.TrackableDrawingDeleted += (s, e) => DeleteTrackableDrawing(e.TrackableDrawing); }
private void AfterDrawingCreation(AbstractDrawing drawing) { // When passing here, it is possible that the drawing has already been initialized. // (for example, for undo of delete, paste or reload from KVA). if (string.IsNullOrEmpty(drawing.Name)) { SetDrawingName(drawing); } if (drawing is IScalable) { ((IScalable)drawing).Scale(this.ImageSize); } if (drawing is ITrackable && AddTrackableDrawingCommand != null) { AddTrackableDrawingCommand.Execute(drawing as ITrackable); } if (drawing is IMeasurable) { IMeasurable measurableDrawing = drawing as IMeasurable; measurableDrawing.CalibrationHelper = calibrationHelper; measurableDrawing.InitializeMeasurableData(trackExtraData); measurableDrawing.ShowMeasurableInfoChanged += MeasurableDrawing_ShowMeasurableInfoChanged; } if (drawing is DrawingDistortionGrid) { DrawingDistortionGrid d = drawing as DrawingDistortionGrid; d.LensCalibrationAsked += LensCalibrationAsked; } }