Exemplo n.º 1
0
        public void DrawPoint(Point2D point, out Shape shape)
        {
            var annotationRectangleSize = CalculateAnnotationRectangleSize();

            shape = new Rectangle
            {
                Width           = annotationRectangleSize,
                Height          = annotationRectangleSize,
                StrokeThickness = 0.2 * annotationRectangleSize,
                Stroke          = Brushes.LawnGreen
            };
            Canvas.SetLeft(shape, point.X - annotationRectangleSize / 2);
            Canvas.SetTop(shape, point.Y - annotationRectangleSize / 2);
            AnnotationShapes.Add(shape);
        }
Exemplo n.º 2
0
        public void SetImage(Image image, bool clearAnnotations = true)
        {
            if (clearAnnotations)
            {
                ClearCanvas();
            }
            Canvas.SetLeft(image, 0);
            Canvas.SetTop(image, 0);
            var existingImage = AnnotationShapes.Where(x => x is Image).ToList();

            existingImage.ForEach(x => AnnotationShapes.Remove(x));
            AnnotationShapes.Insert(0, image);

            CanvasScale = 800.0 / Math.Max(image.Source.Width, image.Source.Height);
            CanvasPan   = new Point2D(0, 0);
            IsImageSet  = true;
        }
Exemplo n.º 3
0
 public void ClearCanvas()
 {
     AnnotationShapes.Clear();
     IsImageSet = false;
 }