public void RemoveElement(SvgElement element) { if (this.flowChilds.Contains(element)) { this.flowChilds.Remove(element); } if (element is IContainer) { SvgElementCollection.ISvgElementEnumerator enumerator1 = ((IContainer)element).ChildList.GetEnumerator(); while (enumerator1.MoveNext()) { SvgElement element1 = (SvgElement)enumerator1.Current; this.RemoveElement(element1); } } if ((element is IGraph) && (((IGraph)element).ClipPath != null)) { this.RemoveElement(((IGraph)element).ClipPath); } SvgElementCollection.ISvgElementEnumerator enumerator2 = element.AnimateList.GetEnumerator(); while (enumerator2.MoveNext()) { ItopVector.Core.Animate.Animate animate1 = (ItopVector.Core.Animate.Animate)enumerator2.Current; if (this.flowChilds.Contains(animate1)) { this.flowChilds.Remove(animate1); } } }
public void Insert(int index, SvgElement element) { if (!this.flowChilds.Contains(element)) { this.flowChilds.Insert(index, element); } index++; if (element.ShowParticular) { SvgElementCollection.ISvgElementEnumerator enumerator1 = element.AnimateList.GetEnumerator(); while (enumerator1.MoveNext()) { ItopVector.Core.Animate.Animate animate1 = (ItopVector.Core.Animate.Animate)enumerator1.Current; if (!this.flowChilds.Contains(animate1)) { this.flowChilds.Insert(index, animate1); index++; } } } if (element is IGraph) { ClipPath path1 = ((IGraph)element).ClipPath; if (path1 != null) { this.Insert(index, path1); } } if (element is IContainer) { SvgElementCollection.ISvgElementEnumerator enumerator2 = ((IContainer)element).ChildList.GetEnumerator(); while (enumerator2.MoveNext()) { SvgElement element1 = (SvgElement)enumerator2.Current; this.Insert(index, element1); } } }
public static float[] GetKeys(SvgElement element) { ArrayList list1 = new ArrayList(0x10); list1.Add(0f); SvgElementCollection.ISvgElementEnumerator enumerator1 = element.AnimateList.GetEnumerator(); while (enumerator1.MoveNext()) { ItopVector.Core.Animate.Animate animate1 = (ItopVector.Core.Animate.Animate)enumerator1.Current; foreach (string text1 in animate1.VirtualTimes) { float single1 = (float)Math.Round((double)ItopVector.Core.Func.Number.ParseFloatStr(text1), 5); single1 = (float)Math.Round((double)(animate1.Begin + (single1 * animate1.Duration)), 1); if (!list1.Contains(single1)) { list1.Add(single1); } } } float[] singleArray1 = new float[list1.Count]; list1.CopyTo(singleArray1, 0); Array.Sort(singleArray1, (Array)null, (IComparer)null); return(singleArray1); }
public override XmlElement CreateElement(string prefix, string localName, string ns) { XmlElement element1; if (this.firstload) { // SvgElement element2 = null; if (this.preelement != null) { // if (this.preelement.ParentNode == null) // { // if (this.groups.Count > 0) // { // element2 = (SvgElement) this.groups[this.groups.Count - 1]; // if ((element2 is ContainerElement) && ((ContainerElement) element2).IsValidChild(this.preelement)) // { // ((ContainerElement) element2).ChildList.Add(this.preelement); // } // } // this.groups.Add(this.preelement); // } // else if (this.groups.Count > 0) // { // if(this.preelement.ParentNode is ContainerElement && ((ContainerElement) this.preelement.ParentNode).IsValidChild(this.preelement)) // { // ((ContainerElement)this.preelement.ParentNode).ChildList.Add(this.preelement); // } // // } } } switch (localName) { case "clipPath": { element1 = new ClipPath(prefix, localName, ns, this); break; } case "rect": { element1 = new RectangleElement(prefix, localName, ns, this); break; } case "path": { element1 = new GraphPath(prefix, localName, ns, this); break; } case "polyline": { element1 = new Polyline(prefix, localName, ns, this); break; } case "polygon": { element1 = new Polygon(prefix, localName, ns, this); break; } case "circle": { element1 = new Circle(prefix, localName, ns, this); break; } case "ellipse": { element1 = new Ellips(prefix, localName, ns, this); break; } case "script": { element1 = new SvgScript(prefix, localName, ns, this); break; } case "line": { element1 = new Line(prefix, localName, ns, this); break; } case "connectline": case "connect": { element1 = new ConnectLine(prefix, localName, ns, this); break; } case "g": { element1 = new Group(prefix, localName, ns, this); break; } case "svg": { element1 = new SVG(prefix, localName, ns, this); break; } case "text": { element1 = new Text(prefix, localName, ns, this); break; } case "tspan": { element1 = new TSpan(prefix, localName, ns, this); break; } case "tref": { element1 = new TRef(prefix, localName, ns, this); break; } case "linearGradient": { element1 = new LinearGradient(prefix, localName, ns, this); break; } case "radialGradient": { element1 = new RadialGradients(prefix, localName, ns, this); break; } case "stop": { element1 = new GradientStop(prefix, localName, ns, this); break; } case "symbol": { element1 = new ItopVector.Core.Figure.Symbol(prefix, localName, ns, this); break; } case "marker": { element1 = new ItopVector.Core.Figure.Marker(prefix, localName, ns, this); break; } case "defs": { element1 = new ItopVector.Core.Figure.Defs(prefix, localName, ns, this); break; } case "image": { element1 = new ItopVector.Core.Figure.Image(prefix, localName, ns, this); break; } case "a": { element1 = new ItopVector.Core.Figure.Link(prefix, localName, ns, this); break; } case "use": { element1 = new ItopVector.Core.Figure.Use(prefix, localName, ns, this); break; } case "animate": { element1 = new ItopVector.Core.Animate.Animate(prefix, localName, ns, this); break; } case "set": { element1 = new SetAnimate(prefix, localName, ns, this); break; } case "animateColor": { element1 = new ColorAnimate(prefix, localName, ns, this); break; } case "animateMotion": { element1 = new MotionAnimate(prefix, localName, ns, this); break; } case "animateTransform": { element1 = new TransformAnimate(prefix, localName, ns, this); break; } case "pattern": { element1 = new Pattern(prefix, localName, ns, this); break; } case "audio3d": case "audio": { element1 = new AudioAnimate(prefix, localName, ns, this); break; } case "state"://״̬ { element1 =new State(prefix, localName, ns, this); break; } case "layer": { element1 =new Layer(prefix, localName, ns, this); break; } default: { element1 = base.CreateElement(prefix, localName, ns); break; } } if (element1 is SvgElement) { ((SvgElement) element1).ShowParticular = this.AutoShowAnim; } if ((element1 is SvgElement) && this.firstload) { this.preelement = (SvgElement) element1; } else { this.preelement = null; } if (this.xmlreader != null) { int num3 = this.xmlreader.LineNumber; int num4 = this.xmlreader.LinePosition; } // if ((element1 is SVG) && (this.DocumentType == null)) // { // XmlDocumentType type1 = this.CreateDocumentType("svg", "-/W3C/DTD SVG 1.1/EN", "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd", null); // this.AppendChild(type1); // this.AppendChild(this.CreateWhitespace("\r\n")); // } return element1; }
public static void CreateAnimateValues(ISvgElement svgelement, int time, int maxbegin) { if (svgelement is SvgElement) { SvgElement element1 = (SvgElement)svgelement; element1.AnimateNameValues.Clear(); Hashtable hashtable1 = new Hashtable(0x10); int num1 = 0; int num2 = 0; int num3 = 0; SvgElementCollection.ISvgElementEnumerator enumerator1 = element1.AnimateList.GetEnumerator(); while (enumerator1.MoveNext()) { ItopVector.Core.Animate.Animate animate1 = (ItopVector.Core.Animate.Animate)enumerator1.Current; if (animate1.Begin < maxbegin) { string text1 = animate1.GetAttribute("additive").Trim(); if (((text1 == null) || (text1 == string.Empty)) && (animate1 is MotionAnimate)) { text1 = "sum"; } bool flag1 = text1 == "sum"; string text2 = animate1.AttributeName; int num4 = animate1.Begin; DomType type1 = DomTypeFunc.GetTypeOfAttributeName(text2); object obj1 = animate1.GetAnimateResult((float)time, type1); if ((obj1 != null) && (obj1.ToString() != string.Empty)) { if (element1.AnimateNameValues.ContainsKey(text2)) { AnimateInfo info1 = (AnimateInfo)element1.AnimateNameValues[text2]; info1.Add(obj1, num4, flag1); } else { AnimateInfo info2 = new AnimateInfo(); info2.Add(obj1, num4, flag1); element1.AnimateNameValues.Add(text2, info2); } } if (num1 == 0) { num2 = num4; num3 = num4 + animate1.Duration; continue; } num2 = Math.Min(animate1.Begin, num2); num3 = Math.Max((int)(num4 + animate1.Duration), num3); } } foreach (string text3 in element1.AnimateNameValues.Keys) { DomType type2 = DomTypeFunc.GetTypeOfAttributeName(text3); if (element1.SvgAttributes.ContainsKey(text3)) { object obj2 = element1.SvgAttributes[text3]; object obj3 = AnimFunc.GetAnimateValue(element1, text3, type2, obj2); if (element1.SvgAnimAttributes.ContainsKey(text3)) { element1.SvgAnimAttributes[text3] = obj3; } else { element1.SvgAnimAttributes.Add(text3, obj3); } continue; } object obj4 = null; object obj5 = AnimFunc.GetAnimateValue(element1, text3, type2, obj4); if (element1.SvgAnimAttributes.ContainsKey(text3)) { element1.SvgAnimAttributes[text3] = obj5; continue; } element1.SvgAnimAttributes.Add(text3, obj5); } } }