public LineSymbol(IGraphicFactory graphicFactory, DisplayModel displayModel, string elementName, XmlReader reader, string relativePathPrefix) : base(graphicFactory, displayModel) { this.display = Display.Ifspace; this.rotate = true; this.relativePathPrefix = relativePathPrefix; this.dyScaled = new Dictionary <sbyte?, float?>(); ExtractValues(elementName, reader); }
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 = value.ToDisplay(); } 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); } } }
public PathText(IGraphicFactory graphicFactory, DisplayModel displayModel, string elementName, XmlReader reader) : base(graphicFactory, displayModel) { this.fill = graphicFactory.CreatePaint(); this.fill.Color = Color.Black.ToARGB(); this.fill.Style = Style.Fill; this.fill.TextAlign = Align.Center; this.fills = new Dictionary <sbyte?, IPaint>(); this.stroke = graphicFactory.CreatePaint(); this.stroke.Color = Color.Black.ToARGB(); this.stroke.Style = Style.Stroke; this.stroke.TextAlign = Align.Center; this.strokes = new Dictionary <sbyte?, IPaint>(); this.dyScaled = new Dictionary <sbyte?, float?>(); this.display = Display.Ifspace; ExtractValues(graphicFactory, displayModel, elementName, reader); }
public Caption(IGraphicFactory graphicFactory, DisplayModel displayModel, string elementName, XmlReader reader, IDictionary <string, Symbol> symbols) : base(graphicFactory, displayModel) { this.fill = graphicFactory.CreatePaint(); this.fill.Color = Color.Black.ToARGB(); this.fill.Style = Style.Fill; this.fills = new Dictionary <sbyte?, IPaint>(); this.stroke = graphicFactory.CreatePaint(); this.stroke.Color = Color.Black.ToARGB(); this.stroke.Style = Style.Stroke; this.strokes = new Dictionary <sbyte?, IPaint>(); this.dyScaled = new Dictionary <sbyte?, float?>(); this.display = Display.Ifspace; this.gap = DEFAULT_GAP * displayModel.ScaleFactor; ExtractValues(graphicFactory, displayModel, elementName, reader); if (!string.ReferenceEquals(this.symbolId, null)) { Symbol symbol = symbols[this.symbolId]; if (symbol != null) { this.bitmap = symbol.Bitmap; } } if (this.position == Position.Auto) { // sensible defaults: below if symbolContainer is present, center if not if (this.bitmap == null) { this.position = Position.Center; } else { this.position = Position.Below; } } else if (this.position == Position.Center || this.position == Position.Below || this.position == Position.Above) { this.stroke.TextAlign = Align.Center; this.fill.TextAlign = Align.Center; } else if (this.position == Position.BelowLeft || this.position == Position.AboveLeft || this.position == Position.Left) { this.stroke.TextAlign = Align.Right; this.fill.TextAlign = Align.Right; } else if (this.position == Position.BelowRight || this.position == Position.AboveRight || this.position == Position.Right) { this.stroke.TextAlign = Align.Left; this.fill.TextAlign = Align.Left; } else { throw new System.ArgumentException("Position invalid"); } this.maxTextWidth = displayModel.MaxTextWidth; }
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 = value.ToPosition(); } else if (CAT.Equals(name)) { this.category = value; } else if (DISPLAY.Equals(name)) { this.display = value.ToDisplay(); } else if (DY.Equals(name)) { this.dy = float.Parse(value) * displayModel.ScaleFactor; } else if (FONT_FAMILY.Equals(name)) { fontFamily = value.ToFontFamily(); } else if (FONT_STYLE.Equals(name)) { fontStyle = value.ToFontStyle(); } else if (FONT_SIZE.Equals(name)) { this.fontSize = XmlUtils.ParseNonNegativeFloat(name, value) * displayModel.ScaleFactor; } else if (FILL.Equals(name)) { this.fill.Color = XmlUtils.GetColor(value); } else if (PRIORITY.Equals(name)) { this.priority = int.Parse(value); } else if (STROKE.Equals(name)) { this.stroke.Color = XmlUtils.GetColor(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); }
public Symbol(IGraphicFactory graphicFactory, DisplayModel displayModel, string elementName, XmlReader reader, string relativePathPrefix) : base(graphicFactory, displayModel) { this.relativePathPrefix = relativePathPrefix; this.display = Display.Ifspace; ExtractValues(elementName, reader); }
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 = value.ToDisplay(); } 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); } } }