示例#1
0
        /// <summary>
        /// Load object from serialization stream
        /// </summary>
        /// <param name="info"></param>
        /// <param name="orderNumber"></param>
        public virtual void LoadFromStream(SerializationInfo info, int orderNumber)
        {
            GetProperty().ID = info.GetInt64(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}",
                              entryID, orderNumber));
            GetProperty().Name = info.GetString(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}",
                              entryName, orderNumber));
            overlay = info.GetInt32(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}",
                              entryOverlay, orderNumber));
            GetProperty().Type = (TOOL_TYPE)info.GetInt32(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}",
                              entryType, orderNumber));
            GetProperty().MaxZoom = info.GetInt32(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}",
                              entryMaxZoom, orderNumber));
            GetProperty().MinZoom = info.GetInt32(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}",
                              entryMinZoom, orderNumber));
            GetProperty().DefaultZoom = info.GetInt32(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}",
                              entryDefaultZoom, orderNumber));

            GetProperty().LocalPosition = (PointLatLng)info.GetValue(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}",
                              entryLocalPosition, orderNumber),
                typeof(PointLatLng));

            PointsArray.Clear();
            PointLatLng point;
            int         n = info.GetInt32(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}",
                              entryLengthPoint, orderNumber));

            for (int i = 0; i < n; i++)
            {
                point = (PointLatLng)info.GetValue(
                    String.Format(CultureInfo.InvariantCulture,
                                  "{0}{1}-{2}",
                                  entryPoint, orderNumber, i),
                    typeof(PointLatLng));

                PointsArray.Add(point);
            }

            n = info.GetInt32(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}",
                              entryLengthLink, orderNumber));
            linkArray.Clear();
            for (int i = 0; i < n; i++)
            {
                Object link = (Object)info.GetValue(
                    String.Format(CultureInfo.InvariantCulture,
                                  "{0}{1}-{2}",
                                  entryLink, orderNumber, i),
                    typeof(Object));
                linkArray.Add(link);
            }
        }
示例#2
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);
        }