Exemplo n.º 1
0
        private void ExtractValues(string elementName, XmlReader reader)
        {
            for (int i = 0; i < reader.AttributeCount; ++i)
            {
                reader.MoveToAttribute(i);

                string name  = reader.Name;
                string value = reader.Value;

                if (SRC.Equals(name))
                {
                    this.src = value;
                }
                else if (CAT.Equals(name))
                {
                    this.category = value;
                }
                else if (DISPLAY.Equals(name))
                {
                    this.display = Display.FromString(value);
                }
                else if (ID.Equals(name))
                {
                    this.id = value;
                }
                else if (PRIORITY.Equals(name))
                {
                    this.priority = int.Parse(value);
                }
                else if (SYMBOL_HEIGHT.Equals(name))
                {
                    this.height = XmlUtils.ParseNonNegativeInteger(name, value) * displayModel.ScaleFactor;
                }
                else if (SYMBOL_PERCENT.Equals(name))
                {
                    this.percent = XmlUtils.ParseNonNegativeInteger(name, value);
                }
                else if (SYMBOL_SCALING.Equals(name))
                {
                    this.scaling = FromValue(value);
                }
                else if (SYMBOL_WIDTH.Equals(name))
                {
                    this.width = XmlUtils.ParseNonNegativeInteger(name, value) * displayModel.ScaleFactor;
                }
                else
                {
                    throw XmlUtils.CreateXmlReaderException(elementName, name, value, i);
                }
            }
        }
Exemplo n.º 2
0
        private void ExtractValues(IGraphicFactory graphicFactory, DisplayModel displayModel, string elementName, XmlReader reader)
        {
            FontFamily fontFamily = FontFamily.DEFAULT;
            FontStyle  fontStyle  = FontStyle.NORMAL;

            for (int i = 0; i < reader.AttributeCount; ++i)
            {
                reader.MoveToAttribute(i);

                string name  = reader.Name;
                string value = reader.Value;

                if (K.Equals(name))
                {
                    this.textKey = TextKey.getInstance(value);
                }
                else if (POSITION.Equals(name))
                {
                    this.position = Position.FromString(value);
                }
                else if (CAT.Equals(name))
                {
                    this.category = value;
                }
                else if (DISPLAY.Equals(name))
                {
                    this.display = Display.FromString(value);
                }
                else if (DY.Equals(name))
                {
                    this.dy = float.Parse(value) * displayModel.ScaleFactor;
                }
                else if (FONT_FAMILY.Equals(name))
                {
                    fontFamily = FontFamily.FromString(value);
                }
                else if (FONT_STYLE.Equals(name))
                {
                    fontStyle = FontStyle.FromString(value);
                }
                else if (FONT_SIZE.Equals(name))
                {
                    this.fontSize = XmlUtils.ParseNonNegativeFloat(name, value) * displayModel.ScaleFactor;
                }
                else if (FILL.Equals(name))
                {
                    this.fill.Color = (Color)XmlUtils.GetColor(graphicFactory, value);
                }
                else if (PRIORITY.Equals(name))
                {
                    this.priority = int.Parse(value);
                }
                else if (STROKE.Equals(name))
                {
                    this.stroke.Color = (Color)XmlUtils.GetColor(graphicFactory, value);
                }
                else if (STROKE_WIDTH.Equals(name))
                {
                    this.stroke.StrokeWidth = XmlUtils.ParseNonNegativeFloat(name, value) * displayModel.ScaleFactor;
                }
                else if (SYMBOL_ID.Equals(name))
                {
                    this.symbolId = value;
                }
                else
                {
                    throw XmlUtils.CreateXmlReaderException(elementName, name, value, i);
                }
            }

            this.fill.SetTypeface(fontFamily, fontStyle);
            this.stroke.SetTypeface(fontFamily, fontStyle);

            XmlUtils.CheckMandatoryAttribute(elementName, K, this.textKey);
        }
Exemplo n.º 3
0
        private void ExtractValues(string elementName, XmlReader reader)
        {
            this.repeatGap   = REPEAT_GAP_DEFAULT * displayModel.ScaleFactor;
            this.repeatStart = REPEAT_START_DEFAULT * displayModel.ScaleFactor;

            for (int i = 0; i < reader.AttributeCount; ++i)
            {
                reader.MoveToAttribute(i);

                string name  = reader.Name;
                string value = reader.Value;

                if (SRC.Equals(name))
                {
                    this.src = value;
                }
                else if (DISPLAY.Equals(name))
                {
                    this.display = Display.FromString(value);
                }
                else if (DY.Equals(name))
                {
                    this.dy = float.Parse(value) * displayModel.ScaleFactor;
                }
                else if (ALIGN_CENTER.Equals(name))
                {
                    this.alignCenter = bool.Parse(value);
                }
                else if (CAT.Equals(name))
                {
                    this.category = value;
                }
                else if (PRIORITY.Equals(name))
                {
                    this.priority = int.Parse(value);
                }
                else if (REPEAT.Equals(name))
                {
                    this.repeat = bool.Parse(value);
                }
                else if (REPEAT_GAP.Equals(name))
                {
                    this.repeatGap = float.Parse(value) * displayModel.ScaleFactor;
                }
                else if (REPEAT_START.Equals(name))
                {
                    this.repeatStart = float.Parse(value) * displayModel.ScaleFactor;
                }
                else if (ROTATE.Equals(name))
                {
                    this.rotate = bool.Parse(value);
                }
                else if (SYMBOL_HEIGHT.Equals(name))
                {
                    this.height = XmlUtils.ParseNonNegativeInteger(name, value) * displayModel.ScaleFactor;
                }
                else if (SYMBOL_PERCENT.Equals(name))
                {
                    this.percent = XmlUtils.ParseNonNegativeInteger(name, value);
                }
                else if (SYMBOL_SCALING.Equals(name))
                {
                    this.scaling = FromValue(value);
                }
                else if (SYMBOL_WIDTH.Equals(name))
                {
                    this.width = XmlUtils.ParseNonNegativeInteger(name, value) * displayModel.ScaleFactor;
                }
                else
                {
                    throw XmlUtils.CreateXmlReaderException(elementName, name, value, i);
                }
            }
        }