Exemple #1
0
        private InfosTextDecoration ParseTextDecorationEntry(XmlReader _reader, string _element)
        {
            InfosTextDecoration itd = new InfosTextDecoration();

            while (_reader.Read())
            {
                if (_reader.IsStartElement())
                {
                    if (_reader.Name == "TextDecoration")
                    {
                        itd = InfosTextDecoration.FromXml(_reader);
                    }
                }
                else if (_reader.Name == _element)
                {
                    break;
                }
                else
                {
                    // Fermeture d'un tag interne.
                }
            }

            return(itd);
        }
Exemple #2
0
        public static AbstractDrawing FromXml(XmlTextReader _xmlReader, PointF _scale)
        {
            DrawingAngle2D da = new DrawingAngle2D(0, 0, 0, 0, 0, 0, 0, 0);

            while (_xmlReader.Read())
            {
                if (_xmlReader.IsStartElement())
                {
                    if (_xmlReader.Name == "PointO")
                    {
                        da.PointO = XmlHelper.PointParse(_xmlReader.ReadString(), ';');
                    }
                    else if (_xmlReader.Name == "PointA")
                    {
                        da.PointA = XmlHelper.PointParse(_xmlReader.ReadString(), ';');
                    }
                    else if (_xmlReader.Name == "PointB")
                    {
                        da.PointB = XmlHelper.PointParse(_xmlReader.ReadString(), ';');
                    }
                    else if (_xmlReader.Name == "TextDecoration")
                    {
                        da.m_InfosStyle = InfosTextDecoration.FromXml(_xmlReader);
                        da.UpdateBackgroundFillColor();
                    }
                    else if (_xmlReader.Name == "InfosFading")
                    {
                        da.m_InfosFading.FromXml(_xmlReader);
                    }
                    else
                    {
                        // forward compatibility : ignore new fields.
                    }
                }
                else if (_xmlReader.Name == "Drawing")
                {
                    break;
                }
                else
                {
                    // Fermeture d'un tag interne.
                }
            }

            // We only scale the position (PointO), not the size of the edges,
            // because changing the size of the edges will change angle value.
            Point ShiftOA = new Point(da.PointA.X - da.PointO.X, da.PointA.Y - da.PointO.Y);
            Point ShiftOB = new Point(da.PointB.X - da.PointO.X, da.PointB.Y - da.PointO.Y);

            da.PointO = new Point((int)((float)da.PointO.X * _scale.X), (int)((float)da.PointO.Y * _scale.Y));
            da.PointA = new Point(da.PointO.X + ShiftOA.X, da.PointO.Y + ShiftOA.Y);
            da.PointB = new Point(da.PointO.X + ShiftOB.X, da.PointO.Y + ShiftOB.Y);

            da.RescaleCoordinates(da.m_fStretchFactor, da.m_DirectZoomTopLeft);
            return(da);
        }
Exemple #3
0
        public static KeyframeLabel FromXml(XmlTextReader _xmlReader, bool _relative, PointF _scale)
        {
            // Read all tags between <KeyframeLabel> and </KeyframeLabel> and fills up an object.

            KeyframeLabel kfl = new KeyframeLabel(_relative, Color.Black);

            while (_xmlReader.Read())
            {
                if (_xmlReader.IsStartElement())
                {
                    if (_xmlReader.Name == "SpacePosition")
                    {
                        Point p       = XmlHelper.PointParse(_xmlReader.ReadString(), ';');
                        Point adapted = new Point((int)((float)p.X * _scale.X), (int)((float)p.Y * _scale.Y));

                        kfl.Background         = new Rectangle(adapted, new Size(10, 10));
                        kfl.RescaledBackground = new Rectangle(adapted, new Size(10, 10));
                    }
                    else if (_xmlReader.Name == "TimePosition")
                    {
                        // Time was stored absolute.
                        kfl.m_iTimestamp = long.Parse(_xmlReader.ReadString());
                    }
                    else if (_xmlReader.Name == "TextDecoration")
                    {
                        kfl.m_TextDecoration = InfosTextDecoration.FromXml(_xmlReader);
                    }

                    /*else if (_xmlReader.Name == "BackgroundBrush")
                     * {
                     *  ParseBackgroundBrush(_xmlReader, kfl);
                     * }
                     * else if (_xmlReader.Name == "Font")
                     * {
                     *  ParseFont(_xmlReader, kfl);
                     * }*/
                    else
                    {
                        // forward compatibility : ignore new fields.
                    }
                }
                else if (_xmlReader.Name == "KeyframeLabel")
                {
                    break;
                }
                else
                {
                    // Fermeture d'un tag interne.
                }
            }

            return(kfl);
        }
Exemple #4
0
        public static AbstractDrawing FromXml(XmlTextReader _xmlReader, PointF _scale)
        {
            DrawingText dt = new DrawingText(0, 0, 0, 0, 0, 0);

            while (_xmlReader.Read())
            {
                if (_xmlReader.IsStartElement())
                {
                    if (_xmlReader.Name == "Text")
                    {
                        dt.m_Text = _xmlReader.ReadString();
                    }
                    else if (_xmlReader.Name == "Position")
                    {
                        Point p = XmlHelper.PointParse(_xmlReader.ReadString(), ';');
                        //dt.Background.Location = new Point(plotGrid.X, plotGrid.Y);

                        // Adapt to new Image size.
                        dt.m_BackgroundRectangle.Location = new Point((int)((float)p.X * _scale.X), (int)((float)p.Y * _scale.Y));
                    }
                    else if (_xmlReader.Name == "TextDecoration")
                    {
                        dt.m_TextStyle = InfosTextDecoration.FromXml(_xmlReader);
                    }
                    else if (_xmlReader.Name == "InfosFading")
                    {
                        dt.m_InfosFading.FromXml(_xmlReader);
                    }
                    else
                    {
                        // forward compatibility : ignore new fields.
                    }
                }
                else if (_xmlReader.Name == "Drawing")
                {
                    break;
                }
                else
                {
                    // Fermeture d'un tag interne.
                }
            }

            dt.RescaleCoordinates(dt.m_fStretchFactor, dt.m_DirectZoomTopLeft);
            dt.AutoSizeTextbox();

            return(dt);
        }