svghmi/gen_index_xhtml.xslt
changeset 3709 7fbcc7b741b7
parent 3687 747ffdafbe31
child 3711 f68449d64d1c
child 3837 efe0b5b21842
equal deleted inserted replaced
3708:2299f25779ce 3709:7fbcc7b741b7
  1215     <xsl:value-of select="local-name()"/>
  1215     <xsl:value-of select="local-name()"/>
  1216     <xsl:text> */
  1216     <xsl:text> */
  1217 </xsl:text>
  1217 </xsl:text>
  1218     <xsl:text>
  1218     <xsl:text>
  1219 </xsl:text>
  1219 </xsl:text>
       
  1220     <xsl:text>const xmlns = "http://www.w3.org/2000/svg";
       
  1221 </xsl:text>
  1220     <xsl:text>let id = document.getElementById.bind(document);
  1222     <xsl:text>let id = document.getElementById.bind(document);
  1221 </xsl:text>
  1223 </xsl:text>
  1222     <xsl:text>var svg_root = id("</xsl:text>
  1224     <xsl:text>var svg_root = id("</xsl:text>
  1223     <xsl:value-of select="$svg/@id"/>
  1225     <xsl:value-of select="$svg/@id"/>
  1224     <xsl:text>");
  1226     <xsl:text>");
  2156 </xsl:text>
  2158 </xsl:text>
  2157     <xsl:text>        }
  2159     <xsl:text>        }
  2158 </xsl:text>
  2160 </xsl:text>
  2159     <xsl:text>    }
  2161     <xsl:text>    }
  2160 </xsl:text>
  2162 </xsl:text>
  2161     <xsl:text>    
  2163     <xsl:text>
  2162 </xsl:text>
  2164 </xsl:text>
  2163     <xsl:text>    undeafen(index){
  2165     <xsl:text>    undeafen(index){
  2164 </xsl:text>
  2166 </xsl:text>
  2165     <xsl:text>        this.deafen[index] = undefined;
  2167     <xsl:text>        this.deafen[index] = undefined;
  2166 </xsl:text>
  2168 </xsl:text>
  2167     <xsl:text>        let [new_val, old_val] = this.incoming[index];
  2169     <xsl:text>        let [new_val, old_val] = this.incoming[index];
  2168 </xsl:text>
  2170 </xsl:text>
  2169     <xsl:text>        this.incoming[index] = undefined;
  2171     <xsl:text>        this.incoming[index] = undefined;
       
  2172 </xsl:text>
       
  2173     <xsl:text>        // TODO: add timestamp argument to dispatch, so that defered data do not appear wrong on graphs
       
  2174 </xsl:text>
       
  2175     <xsl:text>        this.lastdispatch[index] = Date.now();
  2170 </xsl:text>
  2176 </xsl:text>
  2171     <xsl:text>        this.do_dispatch(new_val, old_val, index);
  2177     <xsl:text>        this.do_dispatch(new_val, old_val, index);
  2172 </xsl:text>
  2178 </xsl:text>
  2173     <xsl:text>    }
  2179     <xsl:text>    }
  2174 </xsl:text>
  2180 </xsl:text>
  5584     <xsl:text>    },
  5590     <xsl:text>    },
  5585 </xsl:text>
  5591 </xsl:text>
  5586     <xsl:if test="$have_value">
  5592     <xsl:if test="$have_value">
  5587       <xsl:text>    animate: function(){
  5593       <xsl:text>    animate: function(){
  5588 </xsl:text>
  5594 </xsl:text>
  5589       <xsl:text>        this.value_elt.textContent = String(this.display);
  5595       <xsl:text>        multiline_to_svg_text(this.value_elt, String(this.display));
  5590 </xsl:text>
  5596 </xsl:text>
  5591       <xsl:text>    },
  5597       <xsl:text>    },
  5592 </xsl:text>
  5598 </xsl:text>
  5593     </xsl:if>
  5599     </xsl:if>
  5594     <xsl:for-each select="$action_elements">
  5600     <xsl:for-each select="$action_elements">
  5622       <xsl:value-of select="func:escape_quotes(@inkscape:label)"/>
  5628       <xsl:value-of select="func:escape_quotes(@inkscape:label)"/>
  5623       <xsl:text>");
  5629       <xsl:text>");
  5624 </xsl:text>
  5630 </xsl:text>
  5625     </xsl:for-each>
  5631     </xsl:for-each>
  5626     <xsl:if test="$have_value">
  5632     <xsl:if test="$have_value">
  5627       <xsl:text>        this.value_elt.textContent = "";
  5633       <xsl:text>        multiline_to_svg_text(this.value_elt, "");
  5628 </xsl:text>
  5634 </xsl:text>
  5629     </xsl:if>
  5635     </xsl:if>
  5630     <xsl:text>    },
  5636     <xsl:text>    },
  5631 </xsl:text>
  5637 </xsl:text>
  5632   </xsl:template>
  5638   </xsl:template>
  9143 </xsl:text>
  9149 </xsl:text>
  9144     <xsl:text>
  9150     <xsl:text>
  9145 </xsl:text>
  9151 </xsl:text>
  9146     <xsl:text>        // Compute visible Y range by merging fixed curves Y ranges
  9152     <xsl:text>        // Compute visible Y range by merging fixed curves Y ranges
  9147 </xsl:text>
  9153 </xsl:text>
  9148     <xsl:text>        for(let minmax of this.minmaxes){
  9154     <xsl:text>        for(let varopts of this.variables_options){
  9149 </xsl:text>
  9155 </xsl:text>
  9150     <xsl:text>           if(minmax){
  9156     <xsl:text>            let minmax = varopts.minmax 
  9151 </xsl:text>
  9157 </xsl:text>
  9152     <xsl:text>               let [min,max] = minmax;
  9158     <xsl:text>            if(minmax){
  9153 </xsl:text>
  9159 </xsl:text>
  9154     <xsl:text>               if(min &lt; y_min)
  9160     <xsl:text>                let [min,max] = minmax;
  9155 </xsl:text>
  9161 </xsl:text>
  9156     <xsl:text>                   y_min = min;
  9162     <xsl:text>                if(min &lt; y_min)
  9157 </xsl:text>
  9163 </xsl:text>
  9158     <xsl:text>               if(max &gt; y_max)
  9164     <xsl:text>                    y_min = min;
  9159 </xsl:text>
  9165 </xsl:text>
  9160     <xsl:text>                   y_max = max;
  9166     <xsl:text>                if(max &gt; y_max)
  9161 </xsl:text>
  9167 </xsl:text>
  9162     <xsl:text>           }
  9168     <xsl:text>                    y_max = max;
       
  9169 </xsl:text>
       
  9170     <xsl:text>            }
  9163 </xsl:text>
  9171 </xsl:text>
  9164     <xsl:text>        }
  9172     <xsl:text>        }
  9165 </xsl:text>
  9173 </xsl:text>
  9166     <xsl:text>
  9174     <xsl:text>
  9167 </xsl:text>
  9175 </xsl:text>
  9168     <xsl:text>        if(y_min !== Infinity &amp;&amp; y_max !== -Infinity){
  9176     <xsl:text>        if(y_min !== Infinity &amp;&amp; y_max !== -Infinity){
  9169 </xsl:text>
  9177 </xsl:text>
  9170     <xsl:text>           this.fixed_y_range = true;
  9178     <xsl:text>            this.fixed_y_range = true;
  9171 </xsl:text>
  9179 </xsl:text>
  9172     <xsl:text>        } else {
  9180     <xsl:text>        } else {
  9173 </xsl:text>
  9181 </xsl:text>
  9174     <xsl:text>           this.fixed_y_range = false;
  9182     <xsl:text>            this.fixed_y_range = false;
  9175 </xsl:text>
  9183 </xsl:text>
  9176     <xsl:text>        }
  9184     <xsl:text>        }
  9177 </xsl:text>
  9185 </xsl:text>
  9178     <xsl:text>
  9186     <xsl:text>
  9179 </xsl:text>
  9187 </xsl:text>
  9262     <xsl:text>        // TODO: get PLC time instead of browser time
  9270     <xsl:text>        // TODO: get PLC time instead of browser time
  9263 </xsl:text>
  9271 </xsl:text>
  9264     <xsl:text>        let time = Date.now();
  9272     <xsl:text>        let time = Date.now();
  9265 </xsl:text>
  9273 </xsl:text>
  9266     <xsl:text>
  9274     <xsl:text>
       
  9275 </xsl:text>
       
  9276     <xsl:text>        console.log("dispatch(",value,oldval, index, time);
  9267 </xsl:text>
  9277 </xsl:text>
  9268     <xsl:text>        // naive local buffer impl. 
  9278     <xsl:text>        // naive local buffer impl. 
  9269 </xsl:text>
  9279 </xsl:text>
  9270     <xsl:text>        // data is updated only when graph is visible
  9280     <xsl:text>        // data is updated only when graph is visible
  9271 </xsl:text>
  9281 </xsl:text>
 12753 </xsl:text>
 12763 </xsl:text>
 12754           <xsl:text>create_ws()
 12764           <xsl:text>create_ws()
 12755 </xsl:text>
 12765 </xsl:text>
 12756           <xsl:text>
 12766           <xsl:text>
 12757 </xsl:text>
 12767 </xsl:text>
 12758           <xsl:text>const xmlns = "http://www.w3.org/2000/svg";
       
 12759 </xsl:text>
       
 12760           <xsl:text>var edit_callback;
 12768           <xsl:text>var edit_callback;
 12761 </xsl:text>
 12769 </xsl:text>
 12762           <xsl:text>const localtypes = {"PAGE_LOCAL":null, "HMI_LOCAL":null}
 12770           <xsl:text>const localtypes = {"PAGE_LOCAL":null, "HMI_LOCAL":null}
 12763 </xsl:text>
 12771 </xsl:text>
 12764           <xsl:text>function edit_value(path, valuetype, callback, initial) {
 12772           <xsl:text>function edit_value(path, valuetype, callback, initial) {