Ejemplo 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 (FILL.Equals(name))
                {
                    this.fill.Color = XmlUtils.GetColor(value);
                }
                else if (STROKE.Equals(name))
                {
                    this.stroke.Color = XmlUtils.GetColor(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 if (STROKE_WIDTH.Equals(name))
                {
                    this.strokeWidth = XmlUtils.ParseNonNegativeFloat(name, value) * displayModel.ScaleFactor;
                }
                else
                {
                    throw XmlUtils.CreateXmlReaderException(elementName, name, value, i);
                }
            }
        }
Ejemplo n.º 2
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);
                }
            }
        }
Ejemplo n.º 3
0
        private void ExtractValues(IGraphicFactory graphicFactory, DisplayModel displayModel, string elementName, XmlReader reader, string relativePathPrefix)
        {
            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 (DY.Equals(name))
                {
                    this.dy = float.Parse(value) * displayModel.ScaleFactor;
                }
                else if (STROKE.Equals(name))
                {
                    this.stroke.Color = (Color)XmlUtils.GetColor(graphicFactory, value);
                }
                else if (STROKE_WIDTH.Equals(name))
                {
                    this.strokeWidth = XmlUtils.ParseNonNegativeFloat(name, value) * displayModel.ScaleFactor;
                }
                else if (STROKE_DASHARRAY.Equals(name))
                {
                    float[] floatArray = ParseFloatArray(name, value);
                    for (int f = 0; f < floatArray.Length; ++f)
                    {
                        floatArray[f] = floatArray[f] * displayModel.ScaleFactor;
                    }
                    this.stroke.DashPathEffect = floatArray;
                }
                else if (STROKE_LINECAP.Equals(name))
                {
                    this.stroke.StrokeCap = Cap.FromString(value);
                }
                else if (STROKE_LINEJOIN.Equals(name))
                {
                    this.stroke.StrokeJoin = Join.FromString(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);
                }
            }
        }
Ejemplo n.º 4
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);
                }
            }
        }