0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 function collectedHist = attachToDom(objs, dom, parent, collectedHist)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 if isempty(objs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 % Create empty pzmodel node with the attribute 'shape'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 utils.xml.attachEmptyObjectNode(objs, dom, parent);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 for oo = 1:numel(objs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 obj = objs(oo);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 % Create object node
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 pzmodelNode = dom.createElement('pzmodel');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 pzmodelNode.setAttribute('shape', sprintf('%dx%d', size(objs)));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 % Call superclass
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 collectedHist = attachToDom@ltpda_tf(obj, dom, pzmodelNode, collectedHist);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 % Add poles
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 if isa(obj.poles, 'pz')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 polesNode = dom.createElement('poles');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 collectedHist = obj.poles.attachToDom(dom, polesNode, collectedHist);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 pzmodelNode.appendChild(polesNode);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 % Add zeros
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 if isa(obj.zeros, 'pz')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 zerosNode = dom.createElement('zeros');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 collectedHist = obj.zeros.attachToDom(dom, zerosNode, collectedHist);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 pzmodelNode.appendChild(zerosNode);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 % Add gain
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 gainNode = dom.createElement('gain');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 utils.xml.attachNumberToDom(obj.gain, dom, gainNode)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 pzmodelNode.appendChild(gainNode);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 % Add delay
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 delayNode = dom.createElement('delay');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 utils.xml.attachNumberToDom(obj.delay, dom, delayNode)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 pzmodelNode.appendChild(delayNode);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 % Add to parent node
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 parent.appendChild(pzmodelNode);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 end
|