Last change
on this file since 13067 was
12762,
checked in by aballeit, 9 years ago
|
#2283 GUI updates, Tree-chart, MCTS Version 2 (prune leaves)
|
File size:
2.0 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Xml;
|
---|
3 |
|
---|
4 | namespace SharpVectors.Dom.Svg
|
---|
5 | {
|
---|
6 | public sealed class SvgElementInstanceList : ISvgElementInstanceList
|
---|
7 | {
|
---|
8 | #region Private Fields
|
---|
9 |
|
---|
10 | private SvgElementInstance[] items;
|
---|
11 |
|
---|
12 | #endregion
|
---|
13 |
|
---|
14 | #region Constructors
|
---|
15 |
|
---|
16 | public SvgElementInstanceList(SvgUseElement useElement, SvgElementInstance parent)
|
---|
17 | {
|
---|
18 | if (parent.CorrespondingElement == null)
|
---|
19 | {
|
---|
20 | // Handle non SVGElement cases
|
---|
21 | items = new SvgElementInstance[0];
|
---|
22 | }
|
---|
23 | else if (parent.CorrespondingElement is ISvgUseElement)
|
---|
24 | {
|
---|
25 | // Handle recursive SVGUseElement cases
|
---|
26 | items = new SvgElementInstance[1];
|
---|
27 | ISvgUseElement iUseElement = (ISvgUseElement)parent.CorrespondingElement;
|
---|
28 | items[0] = (SvgElementInstance)iUseElement.InstanceRoot;
|
---|
29 | return;
|
---|
30 | }
|
---|
31 | else
|
---|
32 | {
|
---|
33 | XmlNodeList xmlChildNodes = parent.CorrespondingElement.ChildNodes;
|
---|
34 | for (int i = 0; i < xmlChildNodes.Count; i++)
|
---|
35 | {
|
---|
36 | items[i] = new SvgElementInstance(xmlChildNodes[i], useElement, parent);
|
---|
37 | if (i > 0)
|
---|
38 | {
|
---|
39 | items[i].SetPreviousSibling(items[i - 1]);
|
---|
40 | items[i - 1].SetNextSibling(items[i]);
|
---|
41 | }
|
---|
42 | }
|
---|
43 | }
|
---|
44 | }
|
---|
45 |
|
---|
46 | #endregion
|
---|
47 |
|
---|
48 | #region ISvgElementInstanceList Members
|
---|
49 |
|
---|
50 | public ulong Length
|
---|
51 | {
|
---|
52 | get
|
---|
53 | {
|
---|
54 | return (ulong)items.GetLength(0);
|
---|
55 | }
|
---|
56 | }
|
---|
57 |
|
---|
58 | public ISvgElementInstance Item(ulong index)
|
---|
59 | {
|
---|
60 | if (index < Length)
|
---|
61 | {
|
---|
62 | return (ISvgElementInstance)items.GetValue((int)index);
|
---|
63 | }
|
---|
64 | else return null;
|
---|
65 | }
|
---|
66 |
|
---|
67 | #endregion
|
---|
68 | }
|
---|
69 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.