Ejemplo n.º 1
0
        public DrawingCrossMark(PointF center, long timestamp, long averageTimeStampsPerFrame, DrawingStyle preset = null, IImageToViewportTransformer transformer = null)
        {
            points["0"] = center;
            miniLabel   = new MiniLabel(points["0"], Color.Black, transformer);

            // Decoration & binding with editors
            styleHelper.Color         = Color.CornflowerBlue;
            styleHelper.ValueChanged += StyleHelper_ValueChanged;
            if (preset == null)
            {
                preset = ToolManager.GetStylePreset("CrossMark");
            }

            style = preset.Clone();
            BindStyle();

            infosFading = new InfosFading(timestamp, averageTimeStampsPerFrame);

            ReinitializeMenu();
        }
Ejemplo n.º 2
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 "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();
        }
Ejemplo n.º 3
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 "Origin":
                    center = XmlHelper.ParsePointF(xmlReader.ReadElementContentAsString());
                    break;

                case "Radius":
                    radius = (int)(xmlReader.ReadElementContentAsInt() * scale.X);
                    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 "ShowCenter":
                    showCenter = 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();
            initializing       = false;
            measureInitialized = true;
            miniLabel.SetAttach(center, false);
            miniLabel.BackColor = styleHelper.Color;
        }