コード例 #1
0
 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();
 }
コード例 #2
0
        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);
                }
            }
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
ファイル: AnnotationsService2.cs プロジェクト: hksonngan/Xian
 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);
 }
コード例 #6
0
ファイル: AnnotationsService2.cs プロジェクト: hksonngan/Xian
        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();
        }
コード例 #7
0
ファイル: AnnotationsService2.cs プロジェクト: hksonngan/Xian
        public override void Initialize(IControlGraphic graphic)
        {
            var annotationGraphic = (AnnotationGraphic)graphic;

            base.Initialize(graphic);
            var rulerGraphic = (LinePrimitive)annotationGraphic.Subject;

            Point1 = rulerGraphic.Point1;
            Point2 = rulerGraphic.Point2;
        }
コード例 #8
0
ファイル: AnnotationsService2.cs プロジェクト: hksonngan/Xian
        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;
        }
コード例 #9
0
ファイル: AnnotationsService2.cs プロジェクト: hksonngan/Xian
        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);
        }
コード例 #10
0
ファイル: AnnotationsService2.cs プロジェクト: hksonngan/Xian
        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);
        }
コード例 #11
0
ファイル: AnnotationsService2.cs プロジェクト: hksonngan/Xian
        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);
        }
コード例 #12
0
ファイル: AnnotationsService2.cs プロジェクト: hksonngan/Xian
        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);
        }
コード例 #13
0
        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();
        }
コード例 #14
0
        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);
                }
            }
        }
コード例 #15
0
ファイル: AnnotationsService2.cs プロジェクト: hksonngan/Xian
        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);
            }
        }
コード例 #16
0
 private static InteractiveTextGraphicBuilder CreateInteractiveTextCalloutBuilder(IControlGraphic graphic)
 {
     return(new InteractiveTextCalloutBuilder(graphic.Subject as UserCalloutGraphic));
 }
コード例 #17
0
		private static InteractiveTextGraphicBuilder CreateInteractiveTextAreaBuilder(IControlGraphic graphic)
		{
			return new InteractiveTextAreaBuilder(graphic.Subject as ITextGraphic);
		}
コード例 #18
0
		private static InteractiveTextGraphicBuilder CreateInteractiveTextCalloutBuilder(IControlGraphic graphic)
		{
			return new InteractiveTextCalloutBuilder(graphic.Subject as UserCalloutGraphic);
		}
コード例 #19
0
		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();
		}
コード例 #20
0
ファイル: AnnotationsService2.cs プロジェクト: hksonngan/Xian
 public static bool CanCreateFrom(IControlGraphic graphic)
 {
     return(graphic.Subject is IPointsGraphic && ((IPointsGraphic)graphic.Subject).Points.Count > 3);
 }
コード例 #21
0
ファイル: AnnotationsService2.cs プロジェクト: hksonngan/Xian
 public static bool CanCreateFrom(IControlGraphic graphic)
 {
     return(graphic.Subject is ILineSegmentGraphic);
 }
コード例 #22
0
ファイル: AnnotationsService2.cs プロジェクト: hksonngan/Xian
 public override void Initialize(IControlGraphic graphic)
 {
     base.Initialize(graphic);
     Initialize((ICalloutGraphic)graphic.Subject);
 }
コード例 #23
0
		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);
			}
		}
コード例 #24
0
 private static InteractiveTextGraphicBuilder CreateInteractiveTextAreaBuilder(IControlGraphic graphic)
 {
     return(new InteractiveTextAreaBuilder(graphic.Subject as ITextGraphic));
 }
コード例 #25
0
ファイル: AnnotationsService2.cs プロジェクト: hksonngan/Xian
 public static bool CanCreateFrom(IControlGraphic graphic)
 {
     return(graphic.Subject is ICalloutGraphic);
 }
コード例 #26
0
		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();
		}
コード例 #27
0
ファイル: AnnotationsService2.cs プロジェクト: hksonngan/Xian
 public static bool CanCreateFrom(IControlGraphic graphic)
 {
     return(graphic.Subject is RectanglePrimitive);
 }