Ejemplo n.º 1
0
        public void OnNextPoint(AnnotationPoint point)
        {
            // translate points from surface size to 0-1 range size
            var pt = new AnnotationPoint {
                X = point.X / surfaceSize.Width, Y = point.Y / surfaceSize.Height
            };

            if (pt.X < 0 || pt.Y < 0 || pt.X > 1 || pt.Y > 1)
            {
                return;                                                // reject this point if outside bounds
            }
            if (type == AnnotationType.AdHoc)
            {
                this.annotation.Points.Add(pt); // ad hoc always just adds more points
            }
            else
            {
                // the rest will only have at most two points, the first point and the last point touched
                if (this.annotation.Points.Count <= 1)
                {
                    this.annotation.Points.Add(pt);
                }
                else
                {
                    this.annotation.Points[1] = pt;
                }
            }
        }
Ejemplo n.º 2
0
 public static AnnotationPoint ConvertFromStandardRangeToSurface(AnnotationPoint point, AnnotationSurfaceSize surface)
 {
     return(new AnnotationPoint {
         X = point.X * surface.Width, Y = point.Y * surface.Height
     });
 }