예제 #1
0
        public void Initialize(WpfLinkVisitor linkVisitor, WpfFontFamilyVisitor fontFamilyVisitor,
                               WpfEmbeddedImageVisitor imageVisitor)
        {
            //TODO: Depreciate this operation as we have more visitors...
            if (linkVisitor != null)
            {
                _linkVisitor = linkVisitor;
            }
            if (fontFamilyVisitor != null)
            {
                _fontFamilyVisitor = fontFamilyVisitor;
            }
            if (imageVisitor != null)
            {
                _imageVisitor = imageVisitor;
            }

            _rootDrawing = new DrawingGroup();

            this.Push(_rootDrawing);


            if (_idVisitor != null && !_idVisitor.IsInitialized)
            {
                _idVisitor.Initialize(this);
            }
            if (_linkVisitor != null && !_linkVisitor.IsInitialized)
            {
                _linkVisitor.Initialize(this);
            }
            if (_classVisitor != null && !_classVisitor.IsInitialized)
            {
                _classVisitor.Initialize(this);
            }
            if (_fontFamilyVisitor != null && !_fontFamilyVisitor.IsInitialized)
            {
                _fontFamilyVisitor.Initialize(this);
            }
            if (_imageVisitor != null && !_imageVisitor.IsInitialized)
            {
                _imageVisitor.Initialize(this);
            }
            if (_linkVisitor != null && _linkVisitor.Aggregates)
            {
                _linkDrawing = new DrawingGroup();

                string groupId = _linkVisitor.AggregatedLayerName;
                if (!string.IsNullOrWhiteSpace(groupId))
                {
                    Runtime.SvgObject.SetName(_linkDrawing, groupId);
                }

                _linkVisitor.Initialize(_linkDrawing, this);
            }
        }
예제 #2
0
 public void Initialize(WpfDrawingContext context)
 {
     if (_idVisitor != null)
     {
         _idVisitor.Initialize(context);
     }
     if (_linkVisitor != null)
     {
         _linkVisitor.Initialize(context);
     }
     if (_classVisitor != null)
     {
         _classVisitor.Initialize(context);
     }
     if (_fontFamilyVisitor != null)
     {
         _fontFamilyVisitor.Initialize(context);
     }
     if (_imageVisitor != null)
     {
         _imageVisitor.Initialize(context);
     }
 }