svghmi/hmi_tree.ysl2
author Edouard Tisserant <edouard.tisserant@gmail.com>
Tue, 17 Mar 2020 08:00:33 +0100
branchsvghmi
changeset 2874 b67af0b8dc72
parent 2873 022db76c3bff
child 2877 682bce953795
permissions -rw-r--r--
SVGHMI: more debug code moved to hmi_tree.ysl2
2873
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
     1
// hmi_tree.ysl2
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
     2
2843
94696b3f69fb SVGHMI : still trying to optimize. Added xslt code to identitfy minimum set of elements needed by a particular page. Plan is to remove unseen/unused elements from the DOM, and re-appending them later when used, on page switch. Disabled previous optimization.
Edouard Tisserant
parents: 2842
diff changeset
     3
2873
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
     4
// HMI Tree computed from VARIABLES.CSV in svghmi.py
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
     5
const "hmitree", "ns:GetHMITree()";
2853
6d39beb19f38 SVGHMI: whitespaces and comments
Edouard Tisserant
parents: 2852
diff changeset
     6
2867
901c89c0cc08 SVGHMI: unsignificant changes or changes in generated code
Edouard Tisserant
parents: 2866
diff changeset
     7
2873
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
     8
// HMI Tree Index
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
     9
const "_indexed_hmitree" apply "$hmitree", mode="index";
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    10
const "indexed_hmitree", "exsl:node-set($_indexed_hmitree)";
2843
94696b3f69fb SVGHMI : still trying to optimize. Added xslt code to identitfy minimum set of elements needed by a particular page. Plan is to remove unseen/unused elements from the DOM, and re-appending them later when used, on page switch. Disabled previous optimization.
Edouard Tisserant
parents: 2842
diff changeset
    11
2873
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    12
template "*", mode="index" {
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    13
    param "index", "0";
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    14
    param "parentpath", "''";
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    15
    const "content" {
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    16
        const "path"
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    17
            choose {
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    18
                when "local-name() = 'HMI_ROOT'" > «$parentpath»
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    19
                otherwise > «$parentpath»/«@name»
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    20
            }
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    21
        choose {
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    22
            when "not(local-name() = $categories/noindex)" {
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    23
                xsl:copy {
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    24
                    attrib "index" > «$index»
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    25
                    attrib "hmipath" > «$path»
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    26
                    foreach "@*" xsl:copy;
2791
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
    27
                }
2873
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    28
                apply "*[1]", mode="index"{
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    29
                     with "index", "$index + 1";
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    30
                     with "parentpath" > «$path»
2854
c7d5f46cc306 SVGHMI: unlink clones (i.e. deep copy elements refered by svg:use) inside widget.
Edouard Tisserant
parents: 2853
diff changeset
    31
                }
c7d5f46cc306 SVGHMI: unlink clones (i.e. deep copy elements refered by svg:use) inside widget.
Edouard Tisserant
parents: 2853
diff changeset
    32
            }
c7d5f46cc306 SVGHMI: unlink clones (i.e. deep copy elements refered by svg:use) inside widget.
Edouard Tisserant
parents: 2853
diff changeset
    33
            otherwise {
2873
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    34
                apply "*[1]", mode="index"{
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    35
                    with "index", "$index";
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    36
                    with "parentpath" > «$path»
2854
c7d5f46cc306 SVGHMI: unlink clones (i.e. deep copy elements refered by svg:use) inside widget.
Edouard Tisserant
parents: 2853
diff changeset
    37
                }
c7d5f46cc306 SVGHMI: unlink clones (i.e. deep copy elements refered by svg:use) inside widget.
Edouard Tisserant
parents: 2853
diff changeset
    38
            }
c7d5f46cc306 SVGHMI: unlink clones (i.e. deep copy elements refered by svg:use) inside widget.
Edouard Tisserant
parents: 2853
diff changeset
    39
        }
c7d5f46cc306 SVGHMI: unlink clones (i.e. deep copy elements refered by svg:use) inside widget.
Edouard Tisserant
parents: 2853
diff changeset
    40
    }
2842
2f73f001955a SVGHMI: attempt to optimize for webkit, because of really slow style recompute in svg:use : "unlink clones" (as in inkscape) but stop deep-copy when meeting a widget, and create a new clone instead.
Edouard Tisserant
parents: 2841
diff changeset
    41
2873
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    42
    copy "$content";
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    43
    apply "following-sibling::*[1]", mode="index" {
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    44
        with "index", "$index + count(exsl:node-set($content)/*)";
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    45
        with "parentpath" > «$parentpath»
2808
dc78ffa5253d SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents: 2807
diff changeset
    46
    }
2753
9a7e12e96399 SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff changeset
    47
}
2874
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
    48
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
    49
// Debug data
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
    50
template "*", mode="testtree"{
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
    51
    param "indent", "''";
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
    52
    > «$indent» «local-name()» 
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
    53
    foreach "@*" > «local-name()»="«.»" 
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
    54
    > \n
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
    55
    apply "*", mode="testtree" {
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
    56
        with "indent" value "concat($indent,'>')"
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
    57
    };
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
    58
}
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
    59
function "debug_hmitree" {
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
    60
    | Raw HMI tree
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
    61
    apply "$hmitree", mode="testtree";
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
    62
    |
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
    63
    | Indexed HMI tree
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
    64
    apply "$indexed_hmitree", mode="testtree";
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
    65
}
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
    66
!debug_output_calls.append("debug_hmitree")