public SvgElementInstanceList(SvgUseElement useElement, SvgElementInstance parent) { if (parent.CorrespondingElement == null) { // Handle non SVGElement cases items = new SvgElementInstance[0]; } else if (parent.CorrespondingElement is ISvgUseElement) { // Handle recursive SVGUseElement cases items = new SvgElementInstance[1]; ISvgUseElement iUseElement = (ISvgUseElement)parent.CorrespondingElement; items[0] = (SvgElementInstance)iUseElement.InstanceRoot; return; } else { XmlNodeList xmlChildNodes = parent.CorrespondingElement.ChildNodes; for (int i = 0; i < xmlChildNodes.Count; i++) { items[i] = new SvgElementInstance(xmlChildNodes[i], useElement, parent); if (i > 0) { items[i].SetPreviousSibling(items[i - 1]); items[i - 1].SetNextSibling(items[i]); } } } }
public SvgElementInstanceList(SvgUseElement useElement, SvgElementInstance parent) { if (parent.CorrespondingElement == null) { // Handle non SVGElement cases items = new SvgElementInstance[0]; } else if (parent.CorrespondingElement is ISvgUseElement) { // Handle recursive SVGUseElement cases items = new SvgElementInstance[1]; items[0] = (SvgElementInstance)((ISvgUseElement)parent).InstanceRoot; return; } else { XmlNodeList xmlChildNodes = parent.CorrespondingElement.ChildNodes; for (int i = 0; i < xmlChildNodes.Count; i++) { items[i] = new SvgElementInstance(xmlChildNodes[i], useElement, parent); if (i > 0) { items[i].SetPreviousSibling(items[i-1]); items[i-1].SetNextSibling(items[i]); } } } }
public SvgElementInstance(XmlNode refNode, SvgUseElement useElement, SvgElementInstance parent) { correspondingUseElement = (ISvgUseElement)useElement; parentNode = (SvgElementInstance)parent; correspondingElement = (ISvgElement)refNode; eventTarget = new EventTarget(this); }
public SvgElementInstance(XmlNode refNode, SvgUseElement useElement, SvgElementInstance parent) { _correspondingUseElement = useElement; _parentNode = parent; _correspondingElement = refNode as ISvgElement; _eventTarget = new EventTarget(this); }
public RectangleF GetBRect(float margin) { if (this is ISharpGDIPath) { ISharpGDIPath gdiPathElm = (ISharpGDIPath)this; GraphicsPath gp = gdiPathElm.GetGraphicsPath(); SvgMatrix svgMatrix = (SvgMatrix)this.GetScreenCTM(); RectangleF bounds = gp.GetBounds(svgMatrix.ToMatrix()); bounds = RectangleF.Inflate(bounds, margin, margin); return(bounds); } else if (this is ISvgUseElement) { SvgUseElement use = (SvgUseElement)this; SvgTransformableElement refEl = use.ReferencedElement as SvgTransformableElement; if (refEl == null) { return(RectangleF.Empty); } XmlElement refElParent = (XmlElement)refEl.ParentNode; OwnerDocument.Static = true; use.CopyToReferencedElement(refEl); this.AppendChild(refEl); RectangleF bbox = refEl.GetBRect(margin); this.RemoveChild(refEl); use.RestoreReferencedElement(refEl); refElParent.AppendChild(refEl); OwnerDocument.Static = false; return(bbox); } else { RectangleF union = RectangleF.Empty; SvgTransformableElement transformChild; foreach (XmlNode childNode in ChildNodes) { if (childNode is SvgDefsElement) { continue; } if (childNode is ISvgTransformable) { transformChild = (SvgTransformableElement)childNode; RectangleF bbox = transformChild.GetBRect(margin); if (bbox != RectangleF.Empty) { if (union == RectangleF.Empty) { union = bbox; } else { union = RectangleF.Union(union, bbox); } } } } return(union); } }