Open SSH socks proxy tunnels:
simon:~ blyth$ ssh -fND localhost:8080 K
simon:~ blyth$ ssh -fND localhost:9090 K
For details, and browser/curl config to use the proxy see env:base/ssh
Directs a URL regexp to cocoon XML generator plot.xq
851 <map:match type="regexp" pattern="^(0)(\d)(\d)(\d)(\d)/plot/(svg|xml)$">
852 <map:generate src="plot.xq" type="xquery" label="sauce" >
Request parameter handling, fork on individual or combined plot, hand over to make-plot.xqm
Mostly cache control, the nitty gritty handed down to rezs.xqm
heprez:source:hfag/mods/webapp/hfagc/xquery/rezs.xqm
- rezs:qtset2svg
- rezs:present-vals
- rezs:qt2svglabel rezs:qt2svgsabel
Label is returned asis from /db/hfagc_system/qtag2svgs.xml
After opening the tunnel
0039 declare variable $rezs:qtag2svgs_index as xs:string { "/db/hfagc_system/qtag2svgs.xml" } ;
....
1618 (:
1619 this is used in individual and combi plot SVGs
1620 :)
1621 declare function rezs:qt2svglabel( $qt as xs:string , $opt as xs:string ) as element() {
1622
1623 let $label := if( doc-available($rezs:qtag2svgs_index) ) then
1624 doc($rezs:qtag2svgs_index)//qtag[@value=$qt]/svgs/label/*
1625 else
1626 <text x="0" y="0"> no label[{$qt}] </text>
Use the interactive XQuery form in the context of hfagc_system collection
To grab the indexed SVG labels:
doc("qtag2svgs.xml")//qtag[@value='BR:-521:-321,221,443']
doc("qtag2svgs.xml")//qtag[@value='BR:-521:-321,221,443']/svgs/label/*[1] (: grabs the svg:g elem :)
doc("qtag2svgs.xml")//qtag[@value='BR:-521:-321,221,443']/svgs/sabel/*[1] (: grabs the svg:g elem :)
Observations on the SVG:
<svg:g exist:id ="14831" exist:source ="/db/hfagc_system/qtag2svgs.xml" id ="slBR_-521_-321+221+443" transform ="translate(154.963,6734.518)" >
<svg:defs >
<svg:path d ="M5.7 -3.324C5.76 -3.564 5.796 -3.708 5.796 -4.032C5.796 -4.752 5.376 -5.292 4.464 -5.292C3.396 -5.292 2.832 -4.536 2.616 -4.236C2.58 ....
...
</svg:defs >
<svg:g id ="slBR_-521_-321+221+443_page1" transform ="matrix(0.996264 0 0 0.996264 0 0)" >
<svg:use x ="56.6248" y ="66" xlink:href ="#slBR_-521_-321+221+443_g0-74" />
<svg:use x ="63.5776" y ="66" xlink:href ="#slBR_-521_-321+221+443_g0-61" />
<svg:use x ="69.4525" y ="66" xlink:href ="#slBR_-521_-321+221+443_g0-32" />
<svg:use x ="77.5219" y ="66" xlink:href ="#slBR_-521_-321+221+443_g1-40" />
<svg:use x ="82.0913" y ="66" xlink:href ="#slBR_-521_-321+221+443_g1-49" />
<svg:use x ="87.9662" y ="66" xlink:href ="#slBR_-521_-321+221+443_g0-83" />
<svg:use x ="95.8911" y ="66" xlink:href ="#slBR_-521_-321+221+443_g1-41" />
<svg:use x ="100.461" y ="66" xlink:href ="#slBR_-521_-321+221+443_g0-17" />
<svg:use x ="106.688" y ="66" xlink:href ="#slBR_-521_-321+221+443_g0-75" />
<svg:use x ="117.547" y ="61.6453" xlink:href ="#slBR_-521_-321+221+443_g2-0" />
</svg:g>
</svg:g>
/Users/heprez/data/data/images/qtags/svg_nofonts/slBR_-521_-321+221+443.svg
<?xml version='1.0' encoding='ISO-8859-1'?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- This file was generated by dvisvgm 1.3 (x86_64-apple-darwin11.4.0) -->
<!-- Mon Jun 24 12:24:51 2013 -->
<svg height='12.1425pt' version='1.1' viewBox='56.4133 56.5997 67.2806 12.1425' width='67.2806pt' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>
<defs>
<path d='M5.7 -3.324C5.76 -3.564 5.796 -3.708 5.796 ...
<path d='M5.592 -1.816C5.72 -1.816 5.896 -1.816 5.896 -2S5.72 -2.184 5.592 -2.184H1.008C0.88 -2.184 0.704 -2.184 0.704 -2S0.88 -1.816 1.008 -1.816H5.592Z' id='g2-0'/>
</defs>
<g id='page1' transform='matrix(0.996264 0 0 0.996264 0 0)'>
<use x='56.6248' xlink:href='#g0-74' y='66'/>
<use x='63.5776' xlink:href='#g0-61' y='66'/>
<use x='69.4525' xlink:href='#g0-32' y='66'/>
<use x='77.5219' xlink:href='#g1-40' y='66'/>
<use x='82.0913' xlink:href='#g1-49' y='66'/>
<use x='87.9662' xlink:href='#g0-83' y='66'/>
<use x='95.8911' xlink:href='#g1-41' y='66'/>
<use x='100.461' xlink:href='#g0-17' y='66'/>
<use x='106.688' xlink:href='#g0-75' y='66'/>
<use x='117.547' xlink:href='#g2-0' y='61.6453'/>
</g>
</svg>
Taking /Users/heprez/data/data/images/qtags/svg_nofonts/slBR_-511_-311+83xoBR_-521_-321+83.svg:
<svg height='18.3592pt' version='1.1' viewBox='57.6088 53.7982 44.272 18.3592' width='44.272pt' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>
<defs>
...
</defs>
<g id='centering' transform='translate(-57.6088,-53.7982)'>
<g id='page1' transform='matrix(0.996264 0 0 0.996264 0 0)'>
<path id='bbox' d="M57.6088 53.7982 h 44.272 v 18.3592 h -44.272 z" fill="none" stroke="blue" />
<use x='58.8804' xlink:href='#g0-89' y='60.69'/>
<use x='65.6958' xlink:href='#g1-40' y='60.69'/>
...
</g>
</g>
</svg>
The centering group and bbox path are based on the viewBox numbers. Instead of crazy gridification, applying such transforms at svgsmry stage can avoid the kludge constant offset.
Use the interactive XQuery form in the context of hfagc_system collection
declare namespace svg="http://www.w3.org/2000/svg" ;
doc("svg-summary.xml")//svg:g[@id='slBR_-521_-321+221+443']
The big transforms hail from back in during summary creation (set by the gridification done in summary creation):
<svg:g exist:id ="1540" exist:source ="/db/hfagc_system/svg-summary.xml" id ="slBR_-521_-321+221+443" transform ="translate(154.963,6734.518)" >
<svg:defs >
<svg:path d ="M5.7 -3.324C5.76 -3.564 5....
Grab the svg:g content and construct new svg:g without the transform attribute:
declare namespace svg="http://www.w3.org/2000/svg" ;
let $qt := 'BR:-521:-321,221,443'
let $g := doc("qtag2svgs.xml")//qtag[@value=$qt]/svgs/sabel/svg:g[1]
return
<svg:g>
{
attribute id {$g/@id}
,
$g/*
}
</svg:g>
1620 declare function rezs:qt2svglabel( $qt as xs:string , $opt as xs:string ) as element() {
1621 let $g := doc($rezs:qtag2svgs_index)//qtag[@value=$qt]/svgs/label/svg:g[1]
1622 let $transform := "translate(0,-66)"
1623 return
1624 <svg:g>
1625 {
1626 attribute id {$g/@id}
1627 ,
1628 attribute transform {$transform}
1629 ,
1630 $g/*
1631 }
1632 </svg:g>
1633 };
1634
1635 declare function rezs:qt2svgsabel( $qt as xs:string , $opt as xs:string ) as element() {
1636 let $g := doc($rezs:qtag2svgs_index)//qtag[@value=$qt]/svgs/sabel/svg:g[1]
1637 let $transform := "translate(0,-66)"
1638 return
1639 <svg:g>
1640 {
1641 attribute id {$g/@id}
1642 ,
1643 attribute transform {$transform}
1644 ,
1645 $g/*
1646 }
1647 </svg:g>
1648 };
1649
import module namespace rezs = "http://hfag.phys.ntu.edu.tw/hfagc/rezs" at "webapp/hfagc/xquery/rezs.xqm" ;
let $qt := 'BR:-521:-321,221,443'
return
rezs:qt2svgsabel( $qt, "" )
propagate:
b2mc:h heprez$ exist-up webapp/hfagc trial # observe non-propagated D0 addition as well as the modified label funcs
Testing on dynamic plot URL, shows the label positions are now in the ball park
Grab from afar:
simon:k blyth$ curl -s --socks5 localhost:9090 http://130.87.106.59:9090/hfagc/01114/plot/svg -o 01114.svg
simon:k blyth$ open 01114.svg
simon:k blyth$ curl -s --socks5 localhost:9090 http://130.87.106.59:9090/hfagc/01214/plot/svg -o 01214.svg
simon:k blyth$ xmllint --format 01214.svg