public override void AfterRender(WpfDrawingRenderer renderer) { if (_isLayer) { WpfDrawingContext context = renderer.Context; context.Pop(); base.AfterRender(renderer); return; } if (_drawGroup != null) { WpfDrawingContext context = renderer.Context; if (context.IncludeRuntime) { // Add the element/object type... SvgObject.SetType(_drawGroup, SvgObjectType.Link); // Add title for tooltips, if any... SvgTitleElement titleElement = this.GetTitleElement(); if (titleElement != null) { string titleValue = titleElement.InnerText; if (!string.IsNullOrWhiteSpace(titleValue)) { SvgObject.SetTitle(_drawGroup, titleValue); } } } DrawingGroup currentGroup = context.Peek(); if (currentGroup == null || currentGroup != _drawGroup) { throw new InvalidOperationException("An existing group is expected."); } context.Pop(); // If not aggregated by a link visitor, we remove it from the links/animation and // add it to the main drawing stack... if (!_isAggregated) { if (context.Links.Children.Remove(_drawGroup)) { currentGroup = context.Peek(); currentGroup.Children.Add(_drawGroup); } } } base.AfterRender(renderer); }
public override void AfterRender(WpfDrawingRenderer renderer) { if (_horzRenderer != null) { _horzRenderer.Uninitialize(); _horzRenderer = null; } if (_vertRenderer != null) { _vertRenderer.Uninitialize(); _vertRenderer = null; } if (_pathRenderer != null) { _pathRenderer.Uninitialize(); _pathRenderer = null; } if (_drawContext != null) { _drawContext.Close(); _drawContext = null; } WpfDrawingContext context = renderer.Context; // TODO-PAUL: Testing this for validity... // Remove the GuidelineSet from the groups added by the FormattedText to reduced the // size of output XAML... if (_drawGroup != null) { ResetGuidelineSet(_drawGroup); } if (context.IncludeRuntime) { if (_drawGroup != null) { // Add the element/object type... SvgObject.SetType(_drawGroup, SvgObjectType.Text); // Add title for tooltips, if any... SvgTitleElement titleElement = _svgElement.SelectSingleNode("title") as SvgTitleElement; if (titleElement != null) { string titleValue = titleElement.InnerText; if (!string.IsNullOrWhiteSpace(titleValue)) { SvgObject.SetTitle(_drawGroup, titleValue); } } } } if (!_isGroupAdded) { if (_drawGroup != null) { if (_isTextPath || _drawGroup.Transform != null || _drawGroup.ClipGeometry != null) { DrawingGroup curGroup = _context.Peek(); Debug.Assert(curGroup != null); if (curGroup != null) { curGroup.Children.Add(_drawGroup); } } else if (_drawGroup.Children.Count != 0) { DrawingGroup firstGroup = _drawGroup.Children[0] as DrawingGroup; if (firstGroup != null && firstGroup.Children.Count != 0) { //Drawing firstDrawing = firstGroup.Children[0]; DrawingGroup curGroup = _context.Peek(); Debug.Assert(curGroup != null); if (curGroup != null) { curGroup.Children.Add(_drawGroup); } } } } } else { if (_drawGroup != null) { DrawingGroup currentGroup = context.Peek(); if (currentGroup == null || currentGroup != _drawGroup) { throw new InvalidOperationException("An existing group is expected."); } context.Pop(); } } _context = null; _drawGroup = null; base.AfterRender(renderer); }