Mercurial > hg > ltpda
comparison m-toolbox/classes/@unit/attachToDom.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 | |
2 function collectedHist = attachToDom(objs, dom, parent, collectedHist) | |
3 | |
4 if isempty(objs) | |
5 | |
6 % Create empty unit node with the attribute 'shape' | |
7 utils.xml.attachEmptyObjectNode(objs, dom, parent); | |
8 | |
9 else | |
10 for oo = 1:numel(objs) | |
11 obj = objs(oo); | |
12 | |
13 appendChild = true; | |
14 % Don't create a unit node if the method is called by one of the | |
15 % properties: xunits, yunits, ounits, iunits | |
16 % Remark: This is only possible if the propertie have only one unit | |
17 % object | |
18 nodeName = utils.xml.mchar(parent.getNodeName); | |
19 if ~isempty(regexp(nodeName, '.units', 'match')) && numel(objs) == 1 | |
20 unitNode = parent; | |
21 appendChild = false; | |
22 else | |
23 % Create object node | |
24 unitNode = dom.createElement('unit'); | |
25 end | |
26 | |
27 % Set shape | |
28 unitNode.setAttribute('shape', sprintf('%dx%d', size(objs))); | |
29 | |
30 % Call superclass | |
31 collectedHist = attachToDom@ltpda_nuo(obj, dom, unitNode, collectedHist); | |
32 | |
33 % Add strs | |
34 unitNode.setAttribute('strs', utils.xml.cellstr2str(obj.strs)); | |
35 | |
36 % Add exps | |
37 unitNode.setAttribute('exps', utils.xml.mat2str(obj.exps)); | |
38 | |
39 % Add vals | |
40 unitNode.setAttribute('vals', utils.xml.mat2str(obj.vals)); | |
41 | |
42 % Add to parent node | |
43 if appendChild | |
44 parent.appendChild(unitNode); | |
45 end | |
46 | |
47 end | |
48 end | |
49 | |
50 end |