protected void AddGraphic(IPresentationImage image, IControlGraphic graphic, IOverlayGraphicsProvider provider) { _undoableCommand = new DrawableUndoableCommand(image); _undoableCommand.Enqueue(new AddGraphicUndoableCommand(graphic, provider.OverlayGraphics)); _undoableCommand.Name = CreationCommandName; _undoableCommand.Execute(); }
private static void UpdateColor(IGraphic graphic, Color color) { StandardStatefulGraphic statefulGraphic = graphic as StandardStatefulGraphic; if (statefulGraphic != null) { statefulGraphic.InactiveColor = color; } if (graphic is IControlGraphic) { IControlGraphic controlGraphic = (IControlGraphic)graphic; controlGraphic.Color = color; } else if (graphic is IVectorGraphic) { ((IVectorGraphic)graphic).Color = color; } if (graphic is CompositeGraphic) { foreach (IGraphic childGraphic in ((CompositeGraphic)graphic).Graphics) { UpdateColor(childGraphic, color); } } }
public override bool Start(IMouseInformation mouseInformation) { base.Start(mouseInformation); if (_graphicBuilder != null) { return(_graphicBuilder.Start(mouseInformation)); } IPresentationImage image = mouseInformation.Tile.PresentationImage; if (!CanStart(image)) { return(false); } var provider = (IOverlayGraphicsProvider)image; IControlGraphic graphic = _graphicDelegateCreatorDelegate(); _graphicBuilder = _interactiveGraphicBuilderDelegate(graphic); _graphicBuilder.GraphicComplete += OnGraphicBuilderInitiallyDone; _graphicBuilder.GraphicCancelled += OnGraphicBuilderInitiallyDone; _graphicBuilder.GraphicFinalComplete += OnGraphicFinalComplete; _graphicBuilder.GraphicFinalCancelled += OnGraphicFinalCancelled; AddGraphic(image, graphic, provider); if (_graphicBuilder.Start(mouseInformation)) { return(true); } this.Cancel(); return(false); }
private void Initialize() { if (_textControlGraphic == null) { _textControlGraphic = InitializeTextControlGraphic(new InvariantTextPrimitive()); _textControlGraphic.Name = "Text"; _textControlGraphic.Color = System.Drawing.Color.Yellow; this.Graphics.Add(_textControlGraphic); } this.TextGraphic.VisualStateChanged += OnTextVisualStateChanged; if (_pointControlGraphic == null) { _pointControlGraphic = InitializePointControlGraphic(new AnchorPointGraphic()); _pointControlGraphic.Name = "Point"; this.Graphics.Add(_pointControlGraphic); } if (_lineGraphic == null) { _lineGraphic = new CrosshairGraphic(false); _lineGraphic.Name = "Line"; _lineGraphic.Color = System.Drawing.Color.Yellow; _lineGraphic.LineStyle = LineStyle.Dash; Graphics.Add(_lineGraphic); } }
public static bool CanCreateFrom(IControlGraphic graphic) { /// TODO (CR Dec 2011): The difference between a protractor /// and a polygon is very slim here ... maybe need to /// move ProtractorGraphic into the core viewer /// or give it an interface of its own. return(graphic.Subject is IPointsGraphic && ((IPointsGraphic)graphic.Subject).Points.Count == 3); }
public override void Initialize(IControlGraphic graphic) { var annotationGraphic = (AnnotationGraphic)graphic; base.Initialize(graphic); var polygonGraphic = (IPointsGraphic)annotationGraphic.Subject; Vertices = polygonGraphic.Points.Select(p => (Point)p).ToArray(); }
public override void Initialize(IControlGraphic graphic) { var annotationGraphic = (AnnotationGraphic)graphic; base.Initialize(graphic); var rulerGraphic = (LinePrimitive)annotationGraphic.Subject; Point1 = rulerGraphic.Point1; Point2 = rulerGraphic.Point2; }
public override void Initialize(IControlGraphic graphic) { var annotationGraphic = (AnnotationGraphic)graphic; base.Initialize(graphic); var ellipseGraphic = (EllipsePrimitive)annotationGraphic.Subject; SemiMinorAxis = ellipseGraphic.BoundingBox.Width / 2F; SemiMajorAxis = ellipseGraphic.BoundingBox.Height / 2F; }
public override void Initialize(IControlGraphic graphic) { var textGraphic = (ITextGraphic)graphic.Subject; base.Initialize(graphic); Text = textGraphic.Text; Location = textGraphic.Location; TopLeft = textGraphic.BoundingBox.Location; BottomRight = textGraphic.BoundingBox.Location + new SizeF(textGraphic.BoundingBox.Width, textGraphic.BoundingBox.Height); }
public override void Initialize(IControlGraphic graphic) { var annotationGraphic = (AnnotationGraphic)graphic; base.Initialize(graphic); var protractorGraphic = (IPointsGraphic)annotationGraphic.Subject; Point1 = protractorGraphic.Points[0]; Vertex = protractorGraphic.Points[1]; Point2 = protractorGraphic.Points[2]; SubtendedAngle = Vector.SubtendedAngle(Point1, Vertex, Point2); }
public virtual void Initialize(IControlGraphic graphic) { IsTileCoordinates = graphic.CoordinateSystem == CoordinateSystem.Destination; var annotationGraphic = graphic as AnnotationGraphic; if (annotationGraphic == null) { return; } Callout = new CalloutAnnotation(); Callout.Initialize(annotationGraphic.Callout); }
public static Annotation CreateFrom(IControlGraphic graphic) { if (EllipseAnnotation.CanCreateFrom(graphic)) { var annotation = new EllipseAnnotation(); annotation.Initialize(graphic); return(annotation); } if (RectangleAnnotation.CanCreateFrom(graphic)) { var annotation = new RectangleAnnotation(); annotation.Initialize(graphic); return(annotation); } if (RulerAnnotation.CanCreateFrom(graphic)) { var annotation = new RulerAnnotation(); annotation.Initialize(graphic); return(annotation); } if (PolygonAnnotation.CanCreateFrom(graphic)) { var annotation = new PolygonAnnotation(); annotation.Initialize(graphic); return(annotation); } if (ProtractorAnnotation.CanCreateFrom(graphic)) { var annotation = new ProtractorAnnotation(); annotation.Initialize(graphic); return(annotation); } if (CalloutAnnotation.CanCreateFrom(graphic)) { var annotation = new CalloutAnnotation(); annotation.Initialize(graphic); return(annotation); } if (TextAreaAnnotation.CanCreateFrom(graphic)) { var annotation = new TextAreaAnnotation(); annotation.Initialize(graphic); return(annotation); } return(null); }
private void OnCloneComplete() { _textControlGraphic = (CollectionUtils.SelectFirst(base.Graphics, delegate(IGraphic test) { return(test.Name == "Text"); }) as IControlGraphic); _pointControlGraphic = (CollectionUtils.SelectFirst(base.Graphics, delegate(IGraphic test) { return(test.Name == "Point"); }) as IControlGraphic); _lineGraphic = CollectionUtils.SelectFirst(base.Graphics, delegate(IGraphic test) { return(test.Name == "Line"); }) as CrosshairGraphic; Platform.CheckForNullReference(_lineGraphic, "_lineGraphic"); Platform.CheckForNullReference(_pointControlGraphic, "_pointControlGraphic"); Platform.CheckForNullReference(_textControlGraphic, "_textControlGraphic"); Initialize(); }
private static void UpdateGraphicStyle(IGraphic graphic, Color color, bool controlGraphics) { if (graphic is IControlGraphic) { IControlGraphic controlGraphic = (IControlGraphic)graphic; controlGraphic.Show = controlGraphics; controlGraphic.Color = color; } else if (graphic is IVectorGraphic) { ((IVectorGraphic)graphic).Color = color; } if (graphic is CompositeGraphic) { foreach (IGraphic childGraphic in ((CompositeGraphic)graphic).Graphics) { UpdateGraphicStyle(childGraphic, color, controlGraphics); } } }
public override void Initialize(IControlGraphic graphic) { var annotationGraphic = (AnnotationGraphic)graphic; base.Initialize(annotationGraphic); var subject = annotationGraphic.Subject; TopLeft = subject.BoundingBox.Location; BottomRight = subject.BoundingBox.Location + subject.BoundingBox.Size; CentrePoint = subject.BoundingBox.Location + new SizeF(subject.BoundingBox.Width / 2F, subject.BoundingBox.Height / 2F); // Note: annotationGraphic.Callout actually creates another instance of the callout // It's ok because we are only interested in the statistics of the roi, not the callout. var callout = annotationGraphic.Callout as RoiCalloutGraphic; if (callout != null) { RoiStatistics = GetStatistics(callout); } }
private static InteractiveTextGraphicBuilder CreateInteractiveTextCalloutBuilder(IControlGraphic graphic) { return(new InteractiveTextCalloutBuilder(graphic.Subject as UserCalloutGraphic)); }
private static InteractiveTextGraphicBuilder CreateInteractiveTextAreaBuilder(IControlGraphic graphic) { return new InteractiveTextAreaBuilder(graphic.Subject as ITextGraphic); }
private static InteractiveTextGraphicBuilder CreateInteractiveTextCalloutBuilder(IControlGraphic graphic) { return new InteractiveTextCalloutBuilder(graphic.Subject as UserCalloutGraphic); }
public static bool CanCreateFrom(IControlGraphic graphic) { return(graphic.Subject is IPointsGraphic && ((IPointsGraphic)graphic.Subject).Points.Count > 3); }
public static bool CanCreateFrom(IControlGraphic graphic) { return(graphic.Subject is ILineSegmentGraphic); }
public override void Initialize(IControlGraphic graphic) { base.Initialize(graphic); Initialize((ICalloutGraphic)graphic.Subject); }
private void Initialize() { if (_textControlGraphic == null) { _textControlGraphic = InitializeTextControlGraphic(new InvariantTextPrimitive()); _textControlGraphic.Name = "Text"; _textControlGraphic.Color = System.Drawing.Color.Yellow; this.Graphics.Add(_textControlGraphic); } this.TextGraphic.VisualStateChanged += OnTextVisualStateChanged; if (_pointControlGraphic == null) { _pointControlGraphic = InitializePointControlGraphic(new AnchorPointGraphic()); _pointControlGraphic.Name = "Point"; this.Graphics.Add(_pointControlGraphic); } if (_lineGraphic == null) { _lineGraphic = new ArrowGraphic(false); _lineGraphic.Name = "Line"; _lineGraphic.Color = System.Drawing.Color.Yellow; _lineGraphic.LineStyle = LineStyle.Dash; this.Graphics.Add(_lineGraphic); } }
private static InteractiveTextGraphicBuilder CreateInteractiveTextAreaBuilder(IControlGraphic graphic) { return(new InteractiveTextAreaBuilder(graphic.Subject as ITextGraphic)); }
public static bool CanCreateFrom(IControlGraphic graphic) { return(graphic.Subject is ICalloutGraphic); }
private void OnCloneComplete() { _textControlGraphic = (CollectionUtils.SelectFirst(base.Graphics, delegate(IGraphic test) { return test.Name == "Text"; }) as IControlGraphic); _pointControlGraphic = (CollectionUtils.SelectFirst(base.Graphics, delegate(IGraphic test) { return test.Name == "Point"; }) as IControlGraphic); _lineGraphic = CollectionUtils.SelectFirst(base.Graphics, delegate(IGraphic test) { return test.Name == "Line"; }) as ArrowGraphic; Platform.CheckForNullReference(_lineGraphic, "_lineGraphic"); Platform.CheckForNullReference(_pointControlGraphic, "_pointControlGraphic"); Platform.CheckForNullReference(_textControlGraphic, "_textControlGraphic"); Initialize(); }
public static bool CanCreateFrom(IControlGraphic graphic) { return(graphic.Subject is RectanglePrimitive); }