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 unit 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 appendChild = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 % Don't create a unit node if the method is called by one of the
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 % properties: xunits, yunits, ounits, iunits
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 % Remark: This is only possible if the propertie have only one unit
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 % object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 nodeName = utils.xml.mchar(parent.getNodeName);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 if ~isempty(regexp(nodeName, '.units', 'match')) && numel(objs) == 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 unitNode = parent;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 appendChild = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 % Create object node
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 unitNode = dom.createElement('unit');
|
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 % Set shape
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 unitNode.setAttribute('shape', sprintf('%dx%d', size(objs)));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 % Call superclass
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 collectedHist = attachToDom@ltpda_nuo(obj, dom, unitNode, collectedHist);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 % Add strs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 unitNode.setAttribute('strs', utils.xml.cellstr2str(obj.strs));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 % Add exps
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 unitNode.setAttribute('exps', utils.xml.mat2str(obj.exps));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 % Add vals
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 unitNode.setAttribute('vals', utils.xml.mat2str(obj.vals));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 % Add to parent node
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 if appendChild
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 parent.appendChild(unitNode);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 end
|
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
|