private void ApplyXmlModel(XmlModel xmlModel) { if (CircleDiagramModel == null || !CircleDiagramModel.IsCorrect() || xmlModel == null) { return; } var countLevels = xmlModel.CountLevels; var mainBackground = SerializeUtils.IntToBrush(xmlModel.MainBackgroundColor); var ringBackground = SerializeUtils.IntToBrush(xmlModel.RingBackgroundColor); var intervalBackground = SerializeUtils.IntToBrush(xmlModel.IntervalBackgroundColor); var nodeBorder = new Pen(SerializeUtils.IntToColor(xmlModel.NodeBorderColor), xmlModel.NodeBorderThickness); var ringBorder = new Pen(SerializeUtils.IntToColor(xmlModel.RingBorderColor), xmlModel.RingBorderThickness); var relationshipPen = new Pen(SerializeUtils.IntToColor(xmlModel.RelationshipPenColor), xmlModel.RelationshipPenThickness); var numerationBrush = SerializeUtils.IntToBrush(xmlModel.NumerationColor); var numerationFont = SerializeUtils.StringToFont(xmlModel.NumerationFont); var numerationBeginNumber = xmlModel.NumerationBeginNumber; var numerationIsInverted = xmlModel.NumerationIsInverted; var nodes = xmlModel.Nodes .Select(GetCircleDiagramNode) .Where(g => g != null).ToList(); var relationships = xmlModel.Relationships .Select(g => GetCircleDiagramRelationship(g, nodes)) .Where(g => g != null).ToList(); CircleDiagramModel.ChangeParametersValues(countLevels, mainBackground, ringBackground, intervalBackground, nodeBorder, ringBorder, relationshipPen, numerationBrush, numerationFont, numerationBeginNumber, numerationIsInverted, nodes, relationships); }
private static CircleDiagramNode GetCircleDiagramNode(XmlNode node) { if (node == null) { return(null); } var name = node.Name; var text = node.Text; var startAngle = node.StartAngle; var sweepAngle = node.SweepAngle; var startCircleNumber = node.StartCircleNumber; var countCircles = node.CountCircles; var background = SerializeUtils.IntToBrush(node.BackgroundColor); var textBrush = SerializeUtils.IntToBrush(node.TextColor); var textFont = SerializeUtils.StringToFont(node.TextFont); return(new CircleDiagramNode(name, text, startAngle, sweepAngle, startCircleNumber, countCircles, background, textBrush, textFont)); }