Exemplo n.º 1
0
        //TODO: Measure
        //TODO: IT

        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            if (Page == null)
            {
                if (_coordinates == null)
                {
                    initCoordinates();
                }

                PointF[] points = _coordinates.ToArray();
                ApplyOwner(owner);
                SetPage(page, true);

                _coordinates.Clear();
                _coordinates.Page = page;
                _coordinates.AddRange(points);

                return(this);
            }

            PDFDictionary res = AnnotationBase.Copy(Dictionary);

            MarkupAnnotationBase.CopyTo(Dictionary, res);

            string[] keys = { "LE", "IC", "LL", "LLE", "Cap", "IT", "LLO", "CP", "CO" };
            for (int i = 0; i < keys.Length; ++i)
            {
                IPDFObject obj = Dictionary[keys[i]];
                if (obj != null)
                {
                    res.AddItem(keys[i], obj.Clone());
                }
            }

            PDFArray l = Dictionary["L"] as PDFArray;

            if (l != null)
            {
                RectangleF oldRect;
                if (Page == null)
                {
                    oldRect = new RectangleF();
                }
                else
                {
                    oldRect = Page.PageRect;
                }

                res.AddItem("L", CloneUtility.CopyArrayCoordinates(l, oldRect, page.PageRect, Page == null));
            }

            PDFDictionary bs = Dictionary["BS"] as PDFDictionary;

            if (bs != null)
            {
                res.AddItem("BS", AnnotationBorderStyle.Copy(bs));
            }

            PDFDictionary measure = Dictionary["Measure"] as PDFDictionary;

            if (measure != null)
            {
                res.AddItem("Measure", Measure.Copy(measure));
            }

            LineAnnotation annot = new LineAnnotation(res, owner);

            annot.SetPage(page, true);

            return(annot);
        }