public RenderThemeBuilder(IGraphicFactory graphicFactory, string elementName, XmlReader reader) { this.baseStrokeWidth = 1f; this.baseTextSize = 1f; this.mapBackground = graphicFactory.CreateColor(Color.WHITE.ToARGB()); ExtractValues(graphicFactory, elementName, reader); }
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(IGraphicFactory graphicFactory, string elementName, XmlReader reader) { for (int i = 0; i < reader.AttributeCount; ++i) { reader.MoveToAttribute(i); string name = reader.Name; string value = reader.Value; if (XMLNS.Equals(name)) { continue; } else if (XMLNS_XSI.Equals(name)) { continue; } else if (XSI_SCHEMALOCATION.Equals(name)) { continue; } else if (VERSION.Equals(name)) { this.version = Convert.ToInt32(XmlUtils.ParseNonNegativeInteger(name, value)); } else if (MAP_BACKGROUND.Equals(name)) { this.mapBackground = XmlUtils.GetColor(graphicFactory, value); } else if (MAP_BACKGROUND_OUTSIDE.Equals(name)) { this.mapBackgroundOutside = XmlUtils.GetColor(graphicFactory, value); this.hasBackgroundOutside = true; } else if (BASE_STROKE_WIDTH.Equals(name)) { this.baseStrokeWidth = XmlUtils.ParseNonNegativeFloat(name, value); } else if (BASE_TEXT_SIZE.Equals(name)) { this.baseTextSize = XmlUtils.ParseNonNegativeFloat(name, value); } else { throw XmlUtils.CreateXmlReaderException(elementName, name, value, i); } } Validate(elementName); }
public Line(IGraphicFactory graphicFactory, DisplayModel displayModel, string elementName, XmlReader reader, int level, string relativePathPrefix) : base(graphicFactory, displayModel) { this.level = level; this.relativePathPrefix = relativePathPrefix; this.stroke = graphicFactory.CreatePaint(); this.stroke.Color = Color.Green.ToARGB(); this.stroke.Style = Style.Stroke; this.stroke.StrokeCap = Cap.Round; this.stroke.StrokeJoin = Join.Round; this.strokes = new Dictionary <sbyte?, IPaint>(); this.dyScaled = new Dictionary <sbyte?, float?>(); ExtractValues(graphicFactory, displayModel, elementName, reader, relativePathPrefix); }
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 Area(IGraphicFactory graphicFactory, DisplayModel displayModel, string elementName, XmlReader reader, int level, string relativePathPrefix) : base(graphicFactory, displayModel) { this.level = level; this.relativePathPrefix = relativePathPrefix; this.fill = graphicFactory.CreatePaint(); this.fill.Color = Color.Transparent.ToARGB(); this.fill.Style = Style.Fill; this.fill.StrokeCap = Cap.Round; this.stroke = graphicFactory.CreatePaint(); this.stroke.Color = Color.Transparent.ToARGB(); this.stroke.Style = Style.Stroke; this.stroke.StrokeCap = Cap.Round; this.strokes = new Dictionary <sbyte?, IPaint>(); ExtractValues(elementName, reader); }
private void ExtractValues(IGraphicFactory graphicFactory, DisplayModel displayModel, string elementName, XmlReader reader) { for (int i = 0; i < reader.AttributeCount; ++i) { reader.MoveToAttribute(i); string name = reader.Name; string value = reader.Value; if (RADIUS.Equals(name) || (XmlUtils.supportOlderRenderThemes && R.Equals(name))) { this.radius = Convert.ToSingle(XmlUtils.ParseNonNegativeFloat(name, value)) * displayModel.ScaleFactor; } else if (SCALE_RADIUS.Equals(name)) { this.scaleRadius = bool.Parse(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 (STROKE_WIDTH.Equals(name)) { this.strokeWidth = XmlUtils.ParseNonNegativeFloat(name, value) * displayModel.ScaleFactor; } else { throw XmlUtils.CreateXmlReaderException(elementName, name, value, i); } } XmlUtils.CheckMandatoryAttribute(elementName, RADIUS, this.radius); }
public Circle(IGraphicFactory graphicFactory, DisplayModel displayModel, string elementName, XmlReader reader, int level) : base(graphicFactory, displayModel) { this.level = level; this.fill = graphicFactory.CreatePaint(); this.fill.Color = Color.Transparent.ToARGB(); this.fill.Style = Style.Fill; this.fills = new Dictionary <sbyte?, IPaint>(); this.stroke = graphicFactory.CreatePaint(); this.stroke.Color = Color.Transparent.ToARGB(); this.stroke.Style = Style.Stroke; this.strokes = new Dictionary <sbyte?, IPaint>(); this.renderRadiusScaled = new Dictionary <sbyte?, float?>(); ExtractValues(graphicFactory, displayModel, elementName, reader); if (!this.scaleRadius) { this.renderRadius = this.radius; this.stroke.StrokeWidth = this.strokeWidth; } }
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(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 = XmlUtils.GetColor(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 = value.ToCap(); } else if (STROKE_LINEJOIN.Equals(name)) { this.stroke.StrokeJoin = value.ToJoin(); } 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); } } }