コード例 #1
0
ファイル: AnnotationsService2.cs プロジェクト: hksonngan/Xian
        public void Initialize(ICalloutGraphic graphic)
        {
            TextArea = new TextAreaAnnotation
            {
                Text        = graphic.Text,
                Location    = graphic.TextLocation,
                TopLeft     = graphic.TextBoundingBox.Location,
                BottomRight = graphic.TextBoundingBox.Location +
                              new SizeF(graphic.TextBoundingBox.Width, graphic.TextBoundingBox.Height)
            };

            AnchorPoint = graphic.AnchorPoint;
        }
コード例 #2
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);
        }