SvgTextRef.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. #pragma warning disable
  6. namespace Svg
  7. {
  8. [SvgElement("tref")]
  9. public class SvgTextRef : SvgTextBase
  10. {
  11. private Uri _referencedElement;
  12. [SvgAttribute("href", SvgAttributeAttribute.XLinkNamespace)]
  13. public virtual Uri ReferencedElement
  14. {
  15. get { return this._referencedElement; }
  16. set { this._referencedElement = value; }
  17. }
  18. internal override IEnumerable<ISvgNode> GetContentNodes()
  19. {
  20. var refText = this.OwnerDocument.IdManager.GetElementById(this.ReferencedElement) as SvgTextBase;
  21. IEnumerable<ISvgNode> contentNodes = null;
  22. if (refText == null)
  23. {
  24. contentNodes = base.GetContentNodes();
  25. }
  26. else
  27. {
  28. contentNodes = refText.GetContentNodes();
  29. }
  30. contentNodes = contentNodes.Where(o => !(o is ISvgDescriptiveElement));
  31. return contentNodes;
  32. }
  33. public override SvgElement DeepCopy()
  34. {
  35. return DeepCopy<SvgTextRef>();
  36. }
  37. public override SvgElement DeepCopy<T>()
  38. {
  39. var newObj = base.DeepCopy<T>() as SvgTextRef;
  40. newObj.X = this.X;
  41. newObj.Y = this.Y;
  42. newObj.Dx = this.Dx;
  43. newObj.Dy = this.Dy;
  44. newObj.Text = this.Text;
  45. newObj.ReferencedElement = this.ReferencedElement;
  46. return newObj;
  47. }
  48. }
  49. }
  50. #pragma warning restore