コード例 #1
0
        public void ReadXml(XmlReader r, PointF scale, TimestampMapper timestampMapper, Metadata metadata)
        {
            Clear();

            r.ReadStartElement();

            while (r.NodeType == XmlNodeType.Element)
            {
                if (r.Name == "Spotlight")
                {
                    AbstractMultiDrawingItem item = MultiDrawingItemSerializer.Deserialize(r, scale, timestampMapper, metadata);
                    Spotlight spotlight           = item as Spotlight;
                    if (spotlight != null)
                    {
                        metadata.AddMultidrawingItem(this, spotlight);
                    }
                }
                else
                {
                    string unparsed = r.ReadOuterXml();
                    log.DebugFormat("Unparsed content in KVA XML: {0}", unparsed);
                }
            }

            r.ReadEndElement();
            initializing = false;
        }
コード例 #2
0
ファイル: TrackFrame.cs プロジェクト: Kinovea/Kinovea
        public TrackFrame(XmlReader r, PointF scale, TimestampMapper timestampMapper)
        {
            bool isEmpty = r.IsEmptyElement;

            long time = 0;
            PositionningSource source   = PositionningSource.Manual;
            PointF             location = PointF.Empty;

            if (r.MoveToAttribute("time"))
            {
                time = timestampMapper(r.ReadContentAsLong());
            }

            if (r.MoveToAttribute("source"))
            {
                source = (PositionningSource)Enum.Parse(typeof(PositionningSource), r.ReadContentAsString());
            }

            if (r.MoveToAttribute("location"))
            {
                location = XmlHelper.ParsePointF(r.ReadContentAsString());
                location = location.Scale(scale.X, scale.Y);
            }

            r.ReadStartElement();

            if (!isEmpty)
            {
                r.ReadEndElement();
            }

            this.time               = time;
            this.location           = location;
            this.positionningSource = source;
        }
コード例 #3
0
ファイル: TrackablePoint.cs プロジェクト: weblate/Kinovea
        public TrackablePoint(XmlReader r, PointF scale, TimestampMapper timeMapper)
        {
            r.ReadStartElement();

            while (r.NodeType == XmlNodeType.Element)
            {
                switch (r.Name)
                {
                case "TrackerParameters":
                    trackerParameters = TrackerParameters.ReadXml(r, scale);
                    break;

                case "NonTrackingValue":
                    nonTrackingValue = XmlHelper.ParsePointF(r.ReadElementContentAsString());
                    nonTrackingValue = nonTrackingValue.Scale(scale.X, scale.Y);
                    break;

                case "CurrentValue":
                    currentValue = XmlHelper.ParsePointF(r.ReadElementContentAsString());
                    currentValue = currentValue.Scale(scale.X, scale.Y);
                    break;

                case "Timeline":
                    ParseTimeline(r, scale, timeMapper);
                    break;

                default:
                    string unparsed = r.ReadOuterXml();
                    break;
                }
            }

            r.ReadEndElement();
        }
コード例 #4
0
        public DrawingTracker(XmlReader r, PointF scale, TimestampMapper timeMapper)
        {
            bool isEmpty = r.IsEmptyElement;

            if (r.MoveToAttribute("id"))
            {
                drawingId = new Guid(r.ReadContentAsString());
            }

            if (r.MoveToAttribute("tracking"))
            {
                isTracking = XmlHelper.ParseBoolean(r.ReadContentAsString());
            }

            r.ReadStartElement();

            while (r.NodeType == XmlNodeType.Element)
            {
                switch (r.Name)
                {
                case "TrackablePoint":
                    ParseTrackablePoint(r, scale, timeMapper);
                    break;

                default:
                    string unparsed = r.ReadOuterXml();
                    break;
                }
            }

            if (!isEmpty)
            {
                r.ReadEndElement();
            }
        }
コード例 #5
0
ファイル: TrackablePoint.cs プロジェクト: weblate/Kinovea
        private void ParseTimeline(XmlReader r, PointF scale, TimestampMapper timeMapper)
        {
            trackTimeline.Clear();

            bool isEmpty = r.IsEmptyElement;

            r.ReadStartElement();

            while (r.NodeType == XmlNodeType.Element)
            {
                switch (r.Name)
                {
                case "Frame":
                    TrackFrame frame = new TrackFrame(r, scale, timeMapper);
                    trackTimeline.Insert(frame.Time, frame);
                    break;

                default:
                    string unparsed = r.ReadOuterXml();
                    break;
                }
            }

            if (!isEmpty)
            {
                r.ReadEndElement();
            }
        }
コード例 #6
0
ファイル: AutoNumberManager.cs プロジェクト: jfpk/kinoveaIDS
        public void ReadXml(XmlReader r, PointF scale, TimestampMapper timestampMapper, Metadata metadata)
        {
            Clear();

            r.ReadStartElement();

            while (r.NodeType == XmlNodeType.Element)
            {
                switch (r.Name)
                {
                case "DrawingStyle":
                    style = new DrawingStyle(r);
                    BindStyle();
                    break;

                case "AutoNumber":
                    AbstractMultiDrawingItem item = MultiDrawingItemSerializer.Deserialize(r, scale, timestampMapper, metadata);
                    AutoNumber number             = item as AutoNumber;
                    if (number != null)
                    {
                        metadata.AddMultidrawingItem(this, number);
                    }
                    break;

                default:
                    string unparsed = r.ReadOuterXml();
                    log.DebugFormat("Unparsed content in KVA XML: {0}", unparsed);
                    break;
                }
            }

            r.ReadEndElement();
        }
コード例 #7
0
ファイル: DrawingAngle.cs プロジェクト: jfpk/kinoveaIDS
        public void ReadXml(XmlReader xmlReader, PointF scale, TimestampMapper timestampMapper)
        {
            if (xmlReader.MoveToAttribute("id"))
            {
                identifier = new Guid(xmlReader.ReadContentAsString());
            }

            if (xmlReader.MoveToAttribute("name"))
            {
                name = xmlReader.ReadContentAsString();
            }

            xmlReader.ReadStartElement();

            while (xmlReader.NodeType == XmlNodeType.Element)
            {
                switch (xmlReader.Name)
                {
                case "PointO":
                    points["o"] = XmlHelper.ParsePointF(xmlReader.ReadElementContentAsString());
                    break;

                case "PointA":
                    points["a"] = XmlHelper.ParsePointF(xmlReader.ReadElementContentAsString());
                    break;

                case "PointB":
                    points["b"] = XmlHelper.ParsePointF(xmlReader.ReadElementContentAsString());
                    break;

                case "DrawingStyle":
                    style = new DrawingStyle(xmlReader);
                    BindStyle();
                    break;

                case "InfosFading":
                    infosFading.ReadXml(xmlReader);
                    break;

                case "Measure":
                    xmlReader.ReadOuterXml();
                    break;

                default:
                    string unparsed = xmlReader.ReadOuterXml();
                    log.DebugFormat("Unparsed content in KVA XML: {0}", unparsed);
                    break;
                }
            }

            xmlReader.ReadEndElement();
            initializing = false;

            points["o"] = points["o"].Scale(scale.X, scale.Y);
            points["a"] = points["a"].Scale(scale.X, scale.Y);
            points["b"] = points["b"].Scale(scale.X, scale.Y);
            SignalAllTrackablePointsMoved();
        }
コード例 #8
0
        public AutoNumber(XmlReader xmlReader, PointF scale, TimestampMapper timestampMapper, Metadata metadata)
            : this(0, 0, Point.Empty, 0)
        {
            ReadXml(xmlReader, scale, timestampMapper);

            infosFading              = new InfosFading(position, metadata.AverageTimeStampsPerFrame);
            infosFading.UseDefault   = false;
            infosFading.FadingFrames = 25;
        }
コード例 #9
0
ファイル: DrawingBitmap.cs プロジェクト: wyj64852999/Kinovea
        public void ReadXml(XmlReader xmlReader, PointF scale, TimestampMapper timestampMapper)
        {
            if (xmlReader.MoveToAttribute("id"))
            {
                identifier = new Guid(xmlReader.ReadContentAsString());
            }

            if (xmlReader.MoveToAttribute("name"))
            {
                name = xmlReader.ReadContentAsString();
            }

            xmlReader.ReadStartElement();

            while (xmlReader.NodeType == XmlNodeType.Element)
            {
                switch (xmlReader.Name)
                {
                case "File":
                    filename = xmlReader.ReadElementContentAsString();
                    break;

                case "BoundingBox":
                    RectangleF rect = XmlHelper.ParseRectangleF(xmlReader.ReadElementContentAsString());
                    boundingBox.Rectangle = rect.ToRectangle();
                    break;

                case "Bitmap":
                    bitmap = XmlHelper.ParseImageFromBase64(xmlReader.ReadElementContentAsString());
                    break;

                case "InfosFading":
                    infosFading.ReadXml(xmlReader);
                    break;

                default:
                    string unparsed = xmlReader.ReadOuterXml();
                    log.DebugFormat("Unparsed content in KVA XML: {0}", unparsed);
                    break;
                }
            }

            xmlReader.ReadEndElement();

            if (bitmap != null)
            {
                filename = null;
            }

            if (bitmap == null && !string.IsNullOrEmpty(filename) && File.Exists(filename))
            {
                bitmap = new Bitmap(filename);
            }

            valid = bitmap != null;
        }
コード例 #10
0
ファイル: DrawingText.cs プロジェクト: sandeepbeniwal/Kinovea
        public void ReadXml(XmlReader xmlReader, PointF scale, TimestampMapper timestampMapper)
        {
            if (xmlReader.MoveToAttribute("id"))
            {
                identifier = new Guid(xmlReader.ReadContentAsString());
            }

            if (xmlReader.MoveToAttribute("name"))
            {
                name = xmlReader.ReadContentAsString();
            }

            xmlReader.ReadStartElement();

            while (xmlReader.NodeType == XmlNodeType.Element)
            {
                switch (xmlReader.Name)
                {
                case "Text":
                    text = xmlReader.ReadElementContentAsString();
                    text = TextHelper.FixMissingCarriageReturns(text);
                    break;

                case "Position":
                    PointF p = XmlHelper.ParsePointF(xmlReader.ReadElementContentAsString());
                    background.Rectangle = new RectangleF(p.Scale(scale.X, scale.Y), SizeF.Empty);
                    break;

                case "ArrowVisible":
                    showArrow = XmlHelper.ParseBoolean(xmlReader.ReadElementContentAsString());
                    break;

                case "ArrowEnd":
                    arrowEnd = XmlHelper.ParsePointF(xmlReader.ReadElementContentAsString());
                    break;

                case "DrawingStyle":
                    style = new DrawingStyle(xmlReader);
                    BindStyle();
                    break;

                case "InfosFading":
                    infosFading.ReadXml(xmlReader);
                    break;

                default:
                    string unparsed = xmlReader.ReadOuterXml();
                    log.DebugFormat("Unparsed content in KVA XML: {0}", unparsed);
                    break;
                }
            }

            xmlReader.ReadEndElement();
            UpdateLabelRectangle();
        }
コード例 #11
0
ファイル: DrawingChrono.cs プロジェクト: jfpk/kinoveaIDS
        private void ParseWorkingValues(XmlReader xmlReader, TimestampMapper timestampMapper)
        {
            if (timestampMapper == null)
            {
                xmlReader.ReadOuterXml();
                return;
            }

            xmlReader.ReadStartElement();

            while (xmlReader.NodeType == XmlNodeType.Element)
            {
                switch (xmlReader.Name)
                {
                case "Visible":
                    visibleTimestamp = timestampMapper(xmlReader.ReadElementContentAsLong(), false);
                    break;

                case "StartCounting":
                    long start = xmlReader.ReadElementContentAsLong();
                    startCountingTimestamp = (start == -1) ? long.MaxValue : timestampMapper(start, false);
                    break;

                case "StopCounting":
                    long stop = xmlReader.ReadElementContentAsLong();
                    stopCountingTimestamp = (stop == -1) ? long.MaxValue : timestampMapper(stop, false);
                    break;

                case "Invisible":
                    long hide = xmlReader.ReadElementContentAsLong();
                    invisibleTimestamp = (hide == -1) ? long.MaxValue : timestampMapper(hide, false);
                    break;

                case "Countdown":
                    countdown = XmlHelper.ParseBoolean(xmlReader.ReadElementContentAsString());
                    break;

                case "UserDuration":
                    xmlReader.ReadOuterXml();
                    break;

                default:
                    string unparsed = xmlReader.ReadOuterXml();
                    log.DebugFormat("Unparsed content in KVA XML: {0}", unparsed);
                    break;
                }
            }

            xmlReader.ReadEndElement();

            SanityCheckValues();
        }
コード例 #12
0
ファイル: DrawingChrono.cs プロジェクト: Kinovea/Kinovea
        private void ParseWorkingValues(XmlReader xmlReader, TimestampMapper timestampMapper)
        {
            if (timestampMapper == null)
            {
                xmlReader.ReadOuterXml();
                return;
            }

            xmlReader.ReadStartElement();

            while (xmlReader.NodeType == XmlNodeType.Element)
            {
                switch (xmlReader.Name)
                {
                case "Visible":
                    visibleTimestamp = timestampMapper(xmlReader.ReadElementContentAsLong());
                    break;

                case "Invisible":
                    long hide = xmlReader.ReadElementContentAsLong();
                    invisibleTimestamp = (hide == -1) ? long.MaxValue : timestampMapper(hide);
                    break;

                case "StartCounting":
                    long start = xmlReader.ReadElementContentAsLong();
                    startCountingTimestamp = (start == -1) ? long.MaxValue : timestampMapper(start);
                    break;

                case "StopCounting":
                    long stop = xmlReader.ReadElementContentAsLong();
                    stopCountingTimestamp = (stop == -1) ? long.MaxValue : timestampMapper(stop);
                    break;

                case "ClockOrigin":
                    long origin = xmlReader.ReadElementContentAsLong();
                    clockOriginTimestamp = (origin == -1) ? long.MaxValue : timestampMapper(origin);
                    break;

                case "UserDuration":
                    xmlReader.ReadOuterXml();
                    break;

                default:
                    string unparsed = xmlReader.ReadOuterXml();
                    log.DebugFormat("Unparsed content in KVA XML: {0}", unparsed);
                    break;
                }
            }

            xmlReader.ReadEndElement();
        }
コード例 #13
0
        public static AbstractDrawing Deserialize(XmlReader r, PointF scaling, TimestampMapper timestampMapper, Metadata metadata)
        {
            AbstractDrawing drawing = null;

            if (r.IsEmptyElement)
            {
                r.ReadStartElement();
                return(null);
            }

            // Find the right class to instanciate.
            // The class must derive from AbstractDrawing and have the corresponding [XmlType] C# attribute.
            bool     drawingRead = false;
            Assembly a           = Assembly.GetExecutingAssembly();

            foreach (Type t in a.GetTypes())
            {
                if (t.BaseType != typeof(AbstractDrawing))
                {
                    continue;
                }

                object[] attributes = t.GetCustomAttributes(typeof(XmlTypeAttribute), false);
                if (attributes.Length <= 0 || ((XmlTypeAttribute)attributes[0]).TypeName != r.Name)
                {
                    continue;
                }

                ConstructorInfo ci = t.GetConstructor(new[] { typeof(XmlReader), typeof(PointF), typeof(TimestampMapper), typeof(Metadata) });
                if (ci == null)
                {
                    break;
                }

                object[] parameters = new object[] { r, scaling, timestampMapper, metadata };
                drawing     = (AbstractDrawing)Activator.CreateInstance(t, parameters);
                drawingRead = drawing != null;

                break;
            }

            if (!drawingRead)
            {
                string unparsed = r.ReadOuterXml();
                log.DebugFormat("Unparsed content in KVA XML: {0}", unparsed);
            }

            return(drawing);
        }
コード例 #14
0
        private void ParseTrackablePoint(XmlReader r, PointF scale, TimestampMapper timeMapper)
        {
            string key = "";

            bool isEmpty = r.IsEmptyElement;

            if (r.MoveToAttribute("key"))
            {
                key = r.ReadContentAsString();
            }

            TrackablePoint point = new TrackablePoint(r, scale, timeMapper);

            trackablePoints.Add(key, point);
        }
コード例 #15
0
        public void ReadXml(XmlReader r, PointF scale, TimestampMapper timeMapper)
        {
            bool isEmpty = r.IsEmptyElement;

            r.ReadStartElement();

            while (r.NodeType == XmlNodeType.Element)
            {
                ReadTracker(r, scale, timeMapper);
            }

            if (!isEmpty)
            {
                r.ReadEndElement();
            }
        }
コード例 #16
0
        public void ReadXml(XmlReader xmlReader, PointF scale, TimestampMapper timestampMapper)
        {
            if (xmlReader.MoveToAttribute("id"))
            {
                identifier = new Guid(xmlReader.ReadContentAsString());
            }

            if (xmlReader.MoveToAttribute("name"))
            {
                name = xmlReader.ReadContentAsString();
            }

            xmlReader.ReadStartElement();

            while (xmlReader.NodeType == XmlNodeType.Element)
            {
                switch (xmlReader.Name)
                {
                case "CenterPoint":
                    PointF p = XmlHelper.ParsePointF(xmlReader.ReadElementContentAsString());
                    points["0"] = p.Scale(scale.X, scale.Y);
                    break;

                case "CoordinatesVisible":
                    ShowMeasurableInfo = XmlHelper.ParseBoolean(xmlReader.ReadElementContentAsString());
                    break;

                case "DrawingStyle":
                    style = new DrawingStyle(xmlReader);
                    BindStyle();
                    break;

                case "InfosFading":
                    infosFading.ReadXml(xmlReader);
                    break;

                default:
                    string unparsed = xmlReader.ReadOuterXml();
                    log.DebugFormat("Unparsed content in KVA XML: {0}", unparsed);
                    break;
                }
            }

            xmlReader.ReadEndElement();
            labelCoordinates.SetAttach(points["0"], true);
            SignalTrackablePointMoved();
        }
コード例 #17
0
        public void ReadXml(XmlReader xmlReader, PointF scale, TimestampMapper timestampMapper)
        {
            if (xmlReader.MoveToAttribute("id"))
            {
                identifier = new Guid(xmlReader.ReadContentAsString());
            }

            if (xmlReader.MoveToAttribute("name"))
            {
                name = xmlReader.ReadContentAsString();
            }

            xmlReader.ReadStartElement();

            while (xmlReader.NodeType == XmlNodeType.Element)
            {
                switch (xmlReader.Name)
                {
                case "Position":
                    PointF p = XmlHelper.ParsePointF(xmlReader.ReadElementContentAsString());
                    mainBackground.Rectangle = new RectangleF(p.Scale(scale.X, scale.Y), SizeF.Empty);
                    break;

                case "Values":
                    ParseWorkingValues(xmlReader, timestampMapper);
                    break;

                case "DrawingStyle":
                    style = new DrawingStyle(xmlReader);
                    BindStyle();
                    break;

                case "Label":
                    ParseLabel(xmlReader);
                    break;

                default:
                    string unparsed = xmlReader.ReadOuterXml();
                    log.DebugFormat("Unparsed content in KVA XML: {0}", unparsed);
                    break;
                }
            }

            xmlReader.ReadEndElement();
            SanityCheckValues();
        }
コード例 #18
0
ファイル: DrawingCircle.cs プロジェクト: jfpk/kinoveaIDS
        public void ReadXml(XmlReader xmlReader, PointF scale, TimestampMapper timestampMapper)
        {
            if (xmlReader.MoveToAttribute("id"))
            {
                identifier = new Guid(xmlReader.ReadContentAsString());
            }

            if (xmlReader.MoveToAttribute("name"))
            {
                name = xmlReader.ReadContentAsString();
            }

            xmlReader.ReadStartElement();

            while (xmlReader.NodeType == XmlNodeType.Element)
            {
                switch (xmlReader.Name)
                {
                case "Origin":
                    center = XmlHelper.ParsePointF(xmlReader.ReadElementContentAsString());
                    break;

                case "Radius":
                    radius = (int)(xmlReader.ReadElementContentAsInt() * scale.X);
                    break;

                case "DrawingStyle":
                    style = new DrawingStyle(xmlReader);
                    BindStyle();
                    break;

                case "InfosFading":
                    infosFading.ReadXml(xmlReader);
                    break;

                default:
                    string unparsed = xmlReader.ReadOuterXml();
                    log.DebugFormat("Unparsed content in KVA XML: {0}", unparsed);
                    break;
                }
            }

            xmlReader.ReadEndElement();
            initializing = false;
        }
コード例 #19
0
        public void ReadXml(XmlReader xmlReader, PointF scale, TimestampMapper timeStampMapper)
        {
            if (timeStampMapper == null)
            {
                timeStampMapper = (t, b) => t;
            }

            if (xmlReader.MoveToAttribute("id"))
            {
                identifier = new Guid(xmlReader.ReadContentAsString());
            }

            xmlReader.ReadStartElement();

            while (xmlReader.NodeType == XmlNodeType.Element)
            {
                switch (xmlReader.Name)
                {
                case "Time":
                    position = timeStampMapper(xmlReader.ReadElementContentAsLong(), false);
                    break;

                case "Center":
                    PointF p = XmlHelper.ParsePointF(xmlReader.ReadElementContentAsString());
                    points["o"] = p.Scale(scale.X, scale.Y);
                    break;

                case "Radius":
                    radius = xmlReader.ReadElementContentAsInt();
                    float minScale = Math.Min(scale.X, scale.Y);
                    radius = (int)(radius * minScale);
                    break;

                default:
                    string unparsed = xmlReader.ReadOuterXml();
                    log.DebugFormat("Unparsed content in KVA XML: {0}", unparsed);
                    break;
                }
            }

            xmlReader.ReadEndElement();
            SignalTrackablePointMoved();
        }
コード例 #20
0
 public void ReadTracker(XmlReader r, PointF scale, TimestampMapper timeMapper)
 {
     if (r.Name == "TrackableDrawing")
     {
         DrawingTracker tracker = new DrawingTracker(r, scale, timeMapper);
         if (trackers.ContainsKey(tracker.ID))
         {
             trackers[tracker.ID].Dispose();
             trackers[tracker.ID] = tracker;
         }
         else
         {
             trackers.Add(tracker.ID, tracker);
         }
     }
     else
     {
         string unparsed = r.ReadOuterXml();
     }
 }
コード例 #21
0
        public void ReadXml(XmlReader xmlReader, PointF scale, TimestampMapper timestampMapper)
        {
            if (timestampMapper == null)
            {
                xmlReader.ReadOuterXml();
                return;
            }

            if (xmlReader.MoveToAttribute("id"))
            {
                identifier = new Guid(xmlReader.ReadContentAsString());
            }

            xmlReader.ReadStartElement();

            while (xmlReader.NodeType == XmlNodeType.Element)
            {
                switch (xmlReader.Name)
                {
                case "Time":
                    position = timestampMapper(xmlReader.ReadElementContentAsLong(), false);
                    break;

                case "Location":
                    PointF p = XmlHelper.ParsePointF(xmlReader.ReadElementContentAsString());
                    background.Rectangle = new RectangleF(p.Scale(scale.X, scale.Y), SizeF.Empty);
                    break;

                case "Value":
                    value = xmlReader.ReadElementContentAsInt();
                    break;

                default:
                    string unparsed = xmlReader.ReadOuterXml();
                    log.DebugFormat("Unparsed content in KVA XML: {0}", unparsed);
                    break;
                }
            }

            xmlReader.ReadEndElement();
        }
コード例 #22
0
ファイル: Keyframe.cs プロジェクト: wyj64852999/Kinovea
        private void ReadXml(XmlReader r, PointF scale, TimestampMapper timestampMapper)
        {
            if (r.MoveToAttribute("id"))
            {
                id = new Guid(r.ReadContentAsString());
            }

            r.ReadStartElement();

            while (r.NodeType == XmlNodeType.Element)
            {
                switch (r.Name)
                {
                case "Position":
                    int inputPosition = r.ReadElementContentAsInt();
                    position = timestampMapper(inputPosition, false);
                    break;

                case "Title":
                    title = r.ReadElementContentAsString();
                    break;

                case "Comment":
                    comments = r.ReadElementContentAsString();
                    break;

                case "Drawings":
                    ParseDrawings(r, scale);
                    break;

                default:
                    string unparsed = r.ReadOuterXml();
                    log.DebugFormat("Unparsed content in KVA XML: {0}", unparsed);
                    break;
                }
            }

            r.ReadEndElement();
        }
コード例 #23
0
ファイル: DrawingSVG.cs プロジェクト: jfpk/kinoveaIDS
        public void ReadXml(XmlReader xmlReader, PointF scale, TimestampMapper timestampMapper)
        {
            if (xmlReader.MoveToAttribute("id"))
            {
                identifier = new Guid(xmlReader.ReadContentAsString());
            }

            if (xmlReader.MoveToAttribute("name"))
            {
                name = xmlReader.ReadContentAsString();
            }

            xmlReader.ReadStartElement();

            while (xmlReader.NodeType == XmlNodeType.Element)
            {
                switch (xmlReader.Name)
                {
                case "File":
                    filename = xmlReader.ReadElementContentAsString();
                    break;

                case "InfosFading":
                    infosFading.ReadXml(xmlReader);
                    break;

                default:
                    string unparsed = xmlReader.ReadOuterXml();
                    log.DebugFormat("Unparsed content in KVA XML: {0}", unparsed);
                    break;
                }
            }

            xmlReader.ReadEndElement();

            LoadSVG(filename);
        }
コード例 #24
0
ファイル: Keyframe.cs プロジェクト: wyj64852999/Kinovea
 public Keyframe(XmlReader xmlReader, PointF scale, TimestampMapper timestampMapper, Metadata metadata)
     : this(0, "", metadata)
 {
     ReadXml(xmlReader, scale, timestampMapper);
 }
コード例 #25
0
ファイル: DrawingLine.cs プロジェクト: jfpk/kinoveaIDS
 public DrawingLine(XmlReader xmlReader, PointF scale, TimestampMapper timestampMapper, Metadata parent)
     : this(PointF.Empty, 0, 0)
 {
     ReadXml(xmlReader, scale, timestampMapper);
 }
コード例 #26
0
 public static Keyframe Deserialize(XmlReader r, PointF scaling, TimestampMapper timestampMapper, Metadata metadata)
 {
     return(new Keyframe(r, scaling, timestampMapper, metadata));
 }
コード例 #27
0
ファイル: DrawingLine.cs プロジェクト: wyj64852999/Kinovea
        public void ReadXml(XmlReader xmlReader, PointF scale, TimestampMapper timestampMapper)
        {
            if (xmlReader.MoveToAttribute("id"))
            {
                identifier = new Guid(xmlReader.ReadContentAsString());
            }

            if (xmlReader.MoveToAttribute("name"))
            {
                name = xmlReader.ReadContentAsString();
            }

            xmlReader.ReadStartElement();

            while (xmlReader.NodeType == XmlNodeType.Element)
            {
                switch (xmlReader.Name)
                {
                case "Start":
                {
                    PointF p = XmlHelper.ParsePointF(xmlReader.ReadElementContentAsString());
                    points["a"] = p.Scale(scale.X, scale.Y);
                    break;
                }

                case "End":
                {
                    PointF p = XmlHelper.ParsePointF(xmlReader.ReadElementContentAsString());
                    points["b"] = p.Scale(scale.X, scale.Y);
                    break;
                }

                case "ExtraData":
                {
                    TypeConverter enumConverter = TypeDescriptor.GetConverter(typeof(TrackExtraData));
                    trackExtraData = (TrackExtraData)enumConverter.ConvertFromString(xmlReader.ReadElementContentAsString());
                    break;
                }

                case "MeasureLabel":
                {
                    miniLabel = new MiniLabel(xmlReader, scale);
                    break;
                }

                case "DrawingStyle":
                    style = new DrawingStyle(xmlReader);
                    BindStyle();
                    break;

                case "InfosFading":
                    infosFading.ReadXml(xmlReader);
                    break;

                case "Measure":
                    xmlReader.ReadOuterXml();
                    break;

                default:
                    string unparsed = xmlReader.ReadOuterXml();
                    log.DebugFormat("Unparsed content in KVA XML: {0}", unparsed);
                    break;
                }
            }

            xmlReader.ReadEndElement();
            initializing       = false;
            measureInitialized = true;
            miniLabel.SetAttach(GetMiddlePoint(), false);
            miniLabel.BackColor = styleHelper.Color;
            SignalAllTrackablePointsMoved();
        }
コード例 #28
0
ファイル: DrawingPencil.cs プロジェクト: jfpk/kinoveaIDS
 public DrawingPencil(XmlReader xmlReader, PointF scale, TimestampMapper timestampMapper, Metadata parent)
     : this(PointF.Empty, 0, 0, ToolManager.GetStylePreset("Pencil"))
 {
     ReadXml(xmlReader, scale, timestampMapper);
 }
コード例 #29
0
ファイル: DrawingPlane.cs プロジェクト: jfpk/kinoveaIDS
 public DrawingPlane(XmlReader xmlReader, PointF scale, TimestampMapper timestampMapper, Metadata parent)
     : this(false, 0, 0, ToolManager.GetStylePreset("Grid"))
 {
     ReadXml(xmlReader, scale, timestampMapper);
 }
コード例 #30
0
ファイル: DrawingPlane.cs プロジェクト: jfpk/kinoveaIDS
        public void ReadXml(XmlReader xmlReader, PointF scale, TimestampMapper timestampMapper)
        {
            if (xmlReader.MoveToAttribute("id"))
            {
                identifier = new Guid(xmlReader.ReadContentAsString());
            }

            if (xmlReader.MoveToAttribute("name"))
            {
                name = xmlReader.ReadContentAsString();
            }

            xmlReader.ReadStartElement();

            while (xmlReader.NodeType == XmlNodeType.Element)
            {
                switch (xmlReader.Name)
                {
                case "PointUpperLeft":
                {
                    quadImage.A = ReadPoint(xmlReader, scale);
                    break;
                }

                case "PointUpperRight":
                {
                    quadImage.B = ReadPoint(xmlReader, scale);
                    break;
                }

                case "PointLowerRight":
                {
                    quadImage.C = ReadPoint(xmlReader, scale);
                    break;
                }

                case "PointLowerLeft":
                {
                    quadImage.D = ReadPoint(xmlReader, scale);
                    break;
                }

                case "Perspective":
                    inPerspective = XmlHelper.ParseBoolean(xmlReader.ReadElementContentAsString());
                    break;

                case "DrawingStyle":
                    style = new DrawingStyle(xmlReader);
                    BindStyle();
                    break;

                case "InfosFading":
                    infosFading.ReadXml(xmlReader);
                    break;

                default:
                    string unparsed = xmlReader.ReadOuterXml();
                    log.DebugFormat("Unparsed content in KVA XML: {0}", unparsed);
                    break;
                }
            }

            xmlReader.ReadEndElement();

            // Sanity check for rectangular constraint.
            if (!inPerspective && !quadImage.IsRectangle)
            {
                inPerspective = true;
            }

            if (inPerspective)
            {
                planeIsConvex = quadImage.IsConvex;
            }

            initialized = true;

            SignalAllTrackablePointsMoved();
        }