Exemplo n.º 1
0
        public bool IsCloseTo(RegionOfInterest other)
        {
            if (Contains(other))
            {
                return(true);
            }
            if (other.Contains(this))
            {
                return(true);
            }

            //double other_distance_to_right = other.left - this.Right;
            //double other_distance_to_left = this.left - other.Right;
            //double horizontal_distance = Math.Max(other_distance_to_right, other_distance_to_left);

            double other_distance_to_top    = top - other.Bottom;
            double other_distance_to_bottom = other.top - Bottom;
            double vertical_distance        = Math.Max(other_distance_to_top, other_distance_to_bottom);

            return
                (true
                 //&& horizontal_distance <= PROXIMITY_MARGIN
                 && vertical_distance <= PROXIMITY_MARGIN
                );
        }
        internal static List <PDFAnnotation> GenerateAnnotations(PDFDocument pdf_document, int page, PDFInkList ink_list)
        {
            List <RegionOfInterest> regions = new List <RegionOfInterest>();

            // Collect all the highlights on this page
            StrokeCollection stroke_collection = ink_list.GetInkStrokeCollection(page);

            if (null != stroke_collection)
            {
                foreach (Stroke stroke in stroke_collection)
                {
                    double SCALE = 1000.0;
                    Rect   bound = stroke.GetBounds();
                    bound.X      /= SCALE;
                    bound.Y      /= SCALE;
                    bound.Width  /= SCALE;
                    bound.Height /= SCALE;

                    regions.Add(new RegionOfInterest(bound.Left, bound.Top, bound.Width, bound.Height));
                }
            }

            RegionOfInterest.AggregateRegions(regions);

            // Build a list of annotations
            List <PDFAnnotation> annotations = RegionOfInterest.ConvertRegionsToPDFAnnotations(regions, INKS_TAG, pdf_document, page);

            return(annotations);
        }
Exemplo n.º 3
0
 public bool Contains(RegionOfInterest other)
 {
     return
         (true &&
          left <= other.left &&
          Right >= other.Right &&
          top <= other.top &&
          Bottom >= other.Bottom
         );
 }
Exemplo n.º 4
0
        public void Incorporate(RegionOfInterest other)
        {
            double right  = Math.Max(Right, other.Right);
            double bottom = Math.Max(Bottom, other.Bottom);

            left = Math.Min(left, other.left);
            top  = Math.Min(top, other.top);

            width  = right - left;
            height = bottom - top;
        }
Exemplo n.º 5
0
        public void Incorporate(RegionOfInterest other)
        {
            double right  = Math.Max(this.Right, other.Right);
            double bottom = Math.Max(this.Bottom, other.Bottom);

            this.left = Math.Min(this.left, other.left);
            this.top  = Math.Min(this.top, other.top);

            this.width  = right - this.left;
            this.height = bottom - this.top;
        }
        internal static List <PDFAnnotation> GenerateAnnotations(PDFDocument pdf_document, int page, PDFHightlightList highlight_list)
        {
            List <RegionOfInterest> regions = new List <RegionOfInterest>();

            // Collect all the highlights on this page
            foreach (var highlight in highlight_list.GetHighlightsForPage(page))
            {
                if (page == highlight.Page && 0 != highlight.Width)
                {
                    regions.Add(new RegionOfInterest(highlight.Left, highlight.Top, highlight.Width, highlight.Height));
                }
            }

            RegionOfInterest.AggregateRegions(regions);

            // Build a list of annotations
            List <PDFAnnotation> annotations = RegionOfInterest.ConvertRegionsToPDFAnnotations(regions, HIGHLIGHTS_TAG, pdf_document, page);

            return(annotations);
        }