45 <xsl:variable name="categories" select="exsl:node-set($_categories)"/> |
45 <xsl:variable name="categories" select="exsl:node-set($_categories)"/> |
46 <xsl:variable name="_indexed_hmitree"> |
46 <xsl:variable name="_indexed_hmitree"> |
47 <xsl:apply-templates mode="index" select="$hmitree"/> |
47 <xsl:apply-templates mode="index" select="$hmitree"/> |
48 </xsl:variable> |
48 </xsl:variable> |
49 <xsl:variable name="indexed_hmitree" select="exsl:node-set($_indexed_hmitree)"/> |
49 <xsl:variable name="indexed_hmitree" select="exsl:node-set($_indexed_hmitree)"/> |
|
50 <func:function name="func:refered_elements"> |
|
51 <xsl:param name="elems"/> |
|
52 <xsl:variable name="descend" select="$elems/descendant-or-self::svg:*"/> |
|
53 <xsl:variable name="clones" select="$descend[self::svg:use]"/> |
|
54 <xsl:variable name="originals" select="//svg:*[concat('#',@id) = $clones/@xlink:href]"/> |
|
55 <xsl:choose> |
|
56 <xsl:when test="$originals"> |
|
57 <func:result select="$descend | func:refered_elements($originals)"/> |
|
58 </xsl:when> |
|
59 <xsl:otherwise> |
|
60 <func:result select="$descend"/> |
|
61 </xsl:otherwise> |
|
62 </xsl:choose> |
|
63 </func:function> |
|
64 <func:function name="func:intersect_1d"> |
|
65 <xsl:param name="a0"/> |
|
66 <xsl:param name="a1"/> |
|
67 <xsl:param name="b0"/> |
|
68 <xsl:param name="b1"/> |
|
69 <xsl:variable name="d0" select="$a0 >= $b0"/> |
|
70 <xsl:variable name="d1" select="$a1 >= $b1"/> |
|
71 <xsl:choose> |
|
72 <xsl:when test="not($d0) and $d1"> |
|
73 <func:result select="3"/> |
|
74 </xsl:when> |
|
75 <xsl:when test="$d0 and not($d1)"> |
|
76 <func:result select="2"/> |
|
77 </xsl:when> |
|
78 <xsl:when test="$d0 = $d1 and $b0 < $a1"> |
|
79 <func:result select="1"/> |
|
80 </xsl:when> |
|
81 <xsl:otherwise> |
|
82 <func:result select="0"/> |
|
83 </xsl:otherwise> |
|
84 </xsl:choose> |
|
85 </func:function> |
|
86 <func:function name="func:intersect"> |
|
87 <xsl:param name="a"/> |
|
88 <xsl:param name="b"/> |
|
89 <xsl:variable name="x_intersect" select="func:intersect_1d($a/@x, $a/@x+$a/@w, $b/@x, $b/@x+$b/@w)"/> |
|
90 <xsl:choose> |
|
91 <xsl:when test="$x_intersect != 0"> |
|
92 <xsl:variable name="y_intersect" select="func:intersect_1d($a/@y, $a/@y+$a/@w, $b/@y, $b/@y+$b/@w)"/> |
|
93 <func:result select="$x_intersect * $y_intersect"/> |
|
94 </xsl:when> |
|
95 <xsl:otherwise> |
|
96 <func:result select="0"/> |
|
97 </xsl:otherwise> |
|
98 </xsl:choose> |
|
99 </func:function> |
|
100 <func:function name="func:overlapping_geometry"> |
|
101 <xsl:param name="elt"/> |
|
102 <xsl:variable name="g" select="$geometry[@Id = $elt/@id]"/> |
|
103 <func:result select="$geometry[@Id != $elt/@id and func:intersect(., $g) = 4]"/> |
|
104 </func:function> |
|
105 <func:function name="func:sumarized_elements"> |
|
106 <xsl:param name="elements"/> |
|
107 <xsl:variable name="short_list" select="$elements[not(ancestor::*/@id = $elements/@id)]"/> |
|
108 <xsl:variable name="filled_groups" select="$short_list/parent::svg:*[not(descendant::*[not(self::svg:g)][not(@id = $short_list/descendant-or-self::*[not(self::svg:g)]/@id)])]"/> |
|
109 <xsl:variable name="groups_to_add" select="$filled_groups[not(ancestor::*/@id = $filled_groups/@id)]"/> |
|
110 <func:result select="$groups_to_add | $short_list[not(ancestor::svg:g/@id = $filled_groups/@id)]"/> |
|
111 </func:function> |
|
112 <func:function name="func:all_related_elements"> |
|
113 <xsl:param name="page"/> |
|
114 <xsl:variable name="page_overlapping_geometry" select="func:overlapping_geometry($page)"/> |
|
115 <xsl:variable name="page_overlapping_elements" select="//svg:*[@id = $page_overlapping_geometry/@Id]"/> |
|
116 <xsl:variable name="page_sub_elements" select="func:refered_elements($page | $page_overlapping_elements)"/> |
|
117 <func:result select="$page_sub_elements"/> |
|
118 </func:function> |
|
119 <func:function name="func:detachable_elements"> |
|
120 <xsl:param name="pages"/> |
|
121 <xsl:choose> |
|
122 <xsl:when test="$pages"> |
|
123 <func:result select="func:sumarized_elements(func:all_related_elements($pages[1])) | func:detachable_elements($pages[position()!=1])"/> |
|
124 </xsl:when> |
|
125 <xsl:otherwise> |
|
126 <func:result select="/.."/> |
|
127 </xsl:otherwise> |
|
128 </xsl:choose> |
|
129 </func:function> |
|
130 <xsl:variable name="detachable_elements" select="func:detachable_elements($hmi_pages)"/> |
|
131 <xsl:variable name="essential_elements" select="$detachable_elements | /svg:svg/svg:defs"/> |
|
132 <xsl:variable name="required_elements" select="$essential_elements//svg:* | $essential_elements/ancestor-or-self::svg:*"/> |
|
133 <xsl:variable name="discardable_elements" select="//svg:*[not(@id = $required_elements/@id)]"/> |
50 <xsl:template mode="index" match="*"> |
134 <xsl:template mode="index" match="*"> |
51 <xsl:param name="index" select="0"/> |
135 <xsl:param name="index" select="0"/> |
52 <xsl:param name="parentpath" select="''"/> |
136 <xsl:param name="parentpath" select="''"/> |
53 <xsl:variable name="content"> |
137 <xsl:variable name="content"> |
54 <xsl:variable name="path"> |
138 <xsl:variable name="path"> |
136 <xsl:comment> |
220 <xsl:comment> |
137 <xsl:apply-templates mode="testtree" select="$hmitree"/> |
221 <xsl:apply-templates mode="testtree" select="$hmitree"/> |
138 </xsl:comment> |
222 </xsl:comment> |
139 <xsl:comment> |
223 <xsl:comment> |
140 <xsl:apply-templates mode="testtree" select="$indexed_hmitree"/> |
224 <xsl:apply-templates mode="testtree" select="$indexed_hmitree"/> |
|
225 </xsl:comment> |
|
226 <xsl:comment> |
|
227 <xsl:text>Detachable : |
|
228 </xsl:text> |
|
229 <xsl:for-each select="$detachable_elements"> |
|
230 <xsl:value-of select="@id"/> |
|
231 <xsl:text> |
|
232 </xsl:text> |
|
233 </xsl:for-each> |
|
234 </xsl:comment> |
|
235 <xsl:comment> |
|
236 <xsl:text>Discardable : |
|
237 </xsl:text> |
|
238 <xsl:for-each select="$discardable_elements"> |
|
239 <xsl:value-of select="@id"/> |
|
240 <xsl:text> |
|
241 </xsl:text> |
|
242 </xsl:for-each> |
141 </xsl:comment> |
243 </xsl:comment> |
142 <html xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1999/xhtml"> |
244 <html xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1999/xhtml"> |
143 <head/> |
245 <head/> |
144 <body style="margin:0;overflow:hidden;"> |
246 <body style="margin:0;overflow:hidden;"> |
145 <xsl:apply-templates mode="inline_svg" select="svg:svg"/> |
247 <xsl:apply-templates mode="inline_svg" select="svg:svg"/> |
198 </widget> |
300 </widget> |
199 </xsl:if> |
301 </xsl:if> |
200 </xsl:variable> |
302 </xsl:variable> |
201 <func:result select="exsl:node-set($ast)"/> |
303 <func:result select="exsl:node-set($ast)"/> |
202 </func:function> |
304 </func:function> |
203 <func:function name="func:refered_elements"> |
|
204 <xsl:param name="elems"/> |
|
205 <xsl:variable name="descend" select="$elems/descendant-or-self::svg:*"/> |
|
206 <xsl:variable name="clones" select="$descend[self::svg:use]"/> |
|
207 <xsl:variable name="originals" select="//svg:*[concat('#',@id) = $clones/@xlink:href]"/> |
|
208 <xsl:choose> |
|
209 <xsl:when test="$originals"> |
|
210 <func:result select="$descend | func:refered_elements($originals)"/> |
|
211 </xsl:when> |
|
212 <xsl:otherwise> |
|
213 <func:result select="$descend"/> |
|
214 </xsl:otherwise> |
|
215 </xsl:choose> |
|
216 </func:function> |
|
217 <func:function name="func:included_geometry"> |
|
218 <xsl:param name="elt"/> |
|
219 <xsl:variable name="g" select="$geometry[@Id = $elt/@id]"/> |
|
220 <func:result select="$geometry[@Id != $elt/@id and @x >= $g/@x and @y >= $g/@y and @x+@w <= $g/@x+$g/@w and @y+@h <= $g/@y+$g/@h]"/> |
|
221 </func:function> |
|
222 <func:function name="func:sumarized_elements"> |
|
223 <xsl:param name="elements"/> |
|
224 <xsl:variable name="short_list" select="$elements[not(ancestor::*/@id = $elements/@id)]"/> |
|
225 <xsl:variable name="filled_groups" select="$short_list/parent::svg:*[not(descendant::*[not(self::svg:g)][not(@id = $short_list/descendant-or-self::*[not(self::svg:g)]/@id)])]"/> |
|
226 <xsl:variable name="groups_to_add" select="$filled_groups[not(ancestor::*/@id = $filled_groups/@id)]"/> |
|
227 <func:result select="$groups_to_add | $short_list[not(ancestor::svg:g/@id = $filled_groups/@id)]"/> |
|
228 </func:function> |
|
229 <func:function name="func:all_related_elements"> |
|
230 <xsl:param name="page"/> |
|
231 <xsl:variable name="page_included_geometry" select="func:included_geometry($page)"/> |
|
232 <xsl:variable name="page_sub_elements" select="func:refered_elements($page)"/> |
|
233 <xsl:variable name="page_included_elements" select="//svg:*[@id = $page_included_geometry/@Id]"/> |
|
234 <func:result select="$page_sub_elements | $page_included_elements"/> |
|
235 </func:function> |
|
236 <xsl:template name="scripts"> |
305 <xsl:template name="scripts"> |
237 <xsl:text>//(function(){ |
306 <xsl:text>//(function(){ |
238 </xsl:text> |
307 </xsl:text> |
239 <xsl:text> |
308 <xsl:text> |
240 </xsl:text> |
309 </xsl:text> |
844 </xsl:text> |
913 </xsl:text> |
845 <xsl:text>var current_page; |
914 <xsl:text>var current_page; |
846 </xsl:text> |
915 </xsl:text> |
847 <xsl:text> |
916 <xsl:text> |
848 </xsl:text> |
917 </xsl:text> |
|
918 <xsl:text>// function prepare_svg() { |
|
919 </xsl:text> |
|
920 <xsl:text>// /* set everybody hidden initially for better performance */ |
|
921 </xsl:text> |
|
922 <xsl:text>// for(let [elt,elt_parent] in detachable_elements){ |
|
923 </xsl:text> |
|
924 <xsl:text>// elt_parent.removeChild(elt) |
|
925 </xsl:text> |
|
926 <xsl:text>// } |
|
927 </xsl:text> |
|
928 <xsl:text>// }; |
|
929 </xsl:text> |
|
930 <xsl:text> |
|
931 </xsl:text> |
849 <xsl:text>function prepare_svg() { |
932 <xsl:text>function prepare_svg() { |
850 </xsl:text> |
933 </xsl:text> |
851 <xsl:text> /* set everybody hidden initially for better performance */ |
934 <xsl:text> /* set everybody hidden initially for better performance */ |
852 </xsl:text> |
935 </xsl:text> |
853 <xsl:text> for(let widget in hmi_widgets){ |
936 <xsl:text> for(let widget_id in hmi_widgets){ |
|
937 </xsl:text> |
|
938 <xsl:text> let widget = hmi_widgets[widget_id]; |
854 </xsl:text> |
939 </xsl:text> |
855 <xsl:text> if(widget.element != undefined) |
940 <xsl:text> if(widget.element != undefined) |
856 </xsl:text> |
941 </xsl:text> |
857 <xsl:text> widget.element.style.display = "none"; |
942 <xsl:text> widget.element.style.display = "none"; |
858 </xsl:text> |
943 </xsl:text> |
859 <xsl:text> } |
944 <xsl:text> } |
860 </xsl:text> |
|
861 <xsl:text> /*for(let name in page_desc){ |
|
862 </xsl:text> |
|
863 <xsl:text> if(name != new_desc){ |
|
864 </xsl:text> |
|
865 <xsl:text> page_desc[name].widget.element.style.display = "none"; |
|
866 </xsl:text> |
|
867 <xsl:text> } |
|
868 </xsl:text> |
|
869 <xsl:text> }*/ |
|
870 </xsl:text> |
945 </xsl:text> |
871 <xsl:text>}; |
946 <xsl:text>}; |
872 </xsl:text> |
947 </xsl:text> |
873 <xsl:text> |
948 <xsl:text> |
874 </xsl:text> |
949 </xsl:text> |