1 %> @ingroup introspection
5 %> (String) Item corresponding
class name
7 %> (3-element vector) Item
's color
9 %> (String) Class title (classtitle property of corresponding class)
11 %> (String) Input class (inputclass property of correspondign class)
13 %> Array of mapitem objects
14 descendants = mapitem.empty;
15 %> (String) Name of ancestor class
20 %> Level of item in the class map tree it belongs to
22 %> Whether the item is a leaf in the map tree it belongs to
25 %> Used when item is converted to list
27 %> Used when item is converted to list
34 methods(Static, Access=private)
35 function [l, flag, index] = to_list_(item, inputobj, level, index, parentindex)
37 no_desc = length(item.descendants);
39 flag = isempty(inputobj);
41 if ~iscell(item.input)
42 flag = isa(inputobj, item.input);
44 for i = 1:length(item.input)
45 if isa(inputobj, item.input{i});
54 temp = copy_obj(item);
58 temp.parentindex = parentindex;
69 index_temp = index+1; % Reserves 1 for current item
70 parentindex_temp = index;
73 parentindex_temp = indexpow;
76 [ltemp, flag_temp, index_] = mapitem.to_list_(item.descendants(i), inputobj, level+1, index_temp, parentindex_temp);
78 if ~flag % first descendant
79 temp = copy_obj(item);
84 temp.parentindex = parentindex;
102 %> @brief Builds an array containing only the items that accept the inputclass
103 %> @return Array of mapitem objects
104 function l = to_list(o, inputclass)
105 if ~exist('inputclass
', 'var
') || isempty(inputclass)
108 % Instantializes object of inputclass to have access to its superclasses
109 inputobj = eval([inputclass, ';
']);
111 [l, flag] = mapitem.to_list_(o, inputobj, 1, 1, 0);
115 %> @brief generates tree in HTML
117 %> @param inputclass Same case as in @ref to_list()
118 function s = to_html(o, inputclass)
119 if ~exist('inputclass
', 'var
') || isempty(inputclass)
122 % Instantializes object of inputclass to have access to its superclasses
123 inputobj = eval([inputclass, ';
']);
125 [l, flag] = mapitem.to_list_(o, inputobj, 1, 1, 0);
128 s = ['<table><tr>
', 10, ...
129 '<td style=
"text-align: centre">Class Name</td>
', 10, ...
130 '<td style=
"text-align: centre">Class Title</td>
', 10, ...
131 '<td style=
"text-align: centre">Complete descent</td>
', 10, ...
135 function ss = close(n)
138 ss = cat(2, ss, '</ul>
');
143 function ss = open(n)
146 ss = cat(2, ss, '<ul>
');
154 if (l(i).level > i_level)
155 % s = cat(2, s, open(1));
156 elseif (l(i).level < i_level)
157 % s = cat(2, s, close(i_level-l(i).level));
159 indent = [repmat('
', 1, (l(i).level-1)*3), '<span style=
"background-color: #', color2hex(l(i).color), '"> </span>
'];
161 obj = eval([l(i).name, '();
']);
163 irverbose(sprintf('Error creating instance of
class "%s
"', l(i).name));
166 s = cat(2, s, '<tr><td>', indent, l(i).name, '</td><td>', indent, l(i).title, '</td>', ...
167 '<td>', obj.get_ancestry(1), '</td>', '</tr>', 10);
168 i_level = l(i).level;
170 s = cat(2, s, '</table>');
171 % s = cat(2, s, close(i_level));