jsxgraph 1.3.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/distrib/README.md +2 -2
- package/distrib/geogebra.min.js +3 -3
- package/distrib/geonext.min.js +3 -3
- package/distrib/index.d.ts +651 -448
- package/distrib/intergeo.min.js +3 -3
- package/distrib/jsxgraph.css +4 -13
- package/distrib/jsxgraphcore.js +9 -25
- package/distrib/jsxgraphsrc.js +28203 -25234
- package/distrib/sketch.min.js +3 -3
- package/package.json +11 -22
- package/src/base/board.js +674 -469
- package/src/base/chart.js +1 -1
- package/src/base/circle.js +23 -1
- package/src/base/composition.js +1 -1
- package/src/base/constants.js +32 -11
- package/src/base/coords.js +4 -4
- package/src/base/coordselement.js +51 -24
- package/src/base/curve.js +308 -117
- package/src/base/element.js +79 -50
- package/src/base/foreignobject.js +463 -0
- package/src/base/group.js +2 -2
- package/src/base/image.js +12 -15
- package/src/base/line.js +108 -21
- package/src/base/point.js +24 -28
- package/src/base/polygon.js +75 -18
- package/src/base/text.js +116 -63
- package/src/base/ticks.js +29 -11
- package/src/base/transformation.js +1 -1
- package/src/base/turtle.js +1 -1
- package/src/element/arc.js +1 -1
- package/src/element/button.js +29 -2
- package/src/element/checkbox.js +31 -1
- package/src/element/comb.js +5 -2
- package/src/element/composition.js +127 -19
- package/src/element/conic.js +46 -5
- package/src/element/input.js +32 -1
- package/src/element/locus.js +2 -2
- package/src/element/measure.js +9 -4
- package/src/element/sector.js +46 -12
- package/src/element/slider.js +17 -12
- package/src/element/slopetriangle.js +1 -1
- package/src/jsxgraph.js +28 -9
- package/src/jxg.js +4 -3
- package/src/loadjsxgraph.js +3 -2
- package/src/math/bst.js +1 -1
- package/src/math/clip.js +550 -345
- package/src/math/complex.js +1 -1
- package/src/math/extrapolate.js +1 -1
- package/src/math/geometry.js +155 -126
- package/src/math/ia.js +290 -21
- package/src/math/math.js +30 -1
- package/src/math/metapost.js +1 -1
- package/src/math/nlp.js +25 -5
- package/src/math/numerics.js +183 -4
- package/src/math/plot.js +4 -4
- package/src/math/poly.js +1 -1
- package/src/math/probfuncs.js +2 -1
- package/src/math/qdt.js +68 -62
- package/src/math/statistics.js +58 -7
- package/src/math/symbolic.js +1 -1
- package/src/options.js +377 -114
- package/src/parser/ca.js +1297 -1291
- package/src/parser/datasource.js +1 -1
- package/src/parser/geonext.js +6 -6
- package/src/parser/jessiecode.js +275 -79
- package/src/parser/jessiescript.js +1 -1
- package/src/reader/cinderella.js +1 -1
- package/src/reader/file.js +1 -1
- package/src/reader/geogebra.js +1 -1
- package/src/reader/geonext.js +1 -1
- package/src/reader/graph.js +1 -1
- package/src/reader/intergeo.js +1 -1
- package/src/reader/sketch.js +21 -13
- package/src/renderer/abstract.js +21 -6
- package/src/renderer/canvas.js +22 -15
- package/src/renderer/no.js +11 -4
- package/src/renderer/svg.js +76 -53
- package/src/renderer/vml.js +36 -32
- package/src/server/server.js +1 -1
- package/src/utils/base64.js +2 -2
- package/src/utils/color.js +148 -3
- package/src/utils/dump.js +21 -15
- package/src/utils/env.js +63 -104
- package/src/utils/event.js +1 -1
- package/src/utils/expect.js +1 -1
- package/src/utils/type.js +30 -19
- package/src/utils/xml.js +1 -1
- package/src/utils/zip.js +1 -1
- package/CHANGELOG.md +0 -1281
package/README.md
CHANGED
|
@@ -77,13 +77,13 @@ dependencies required to build JSXGraph using npm in the JSXGraph root directory
|
|
|
77
77
|
This will create a new subdirectory ```node_modules``` in the JSXGraph root directory which holds
|
|
78
78
|
all tools and libraries required to build ```jsxgraphcore.js```.
|
|
79
79
|
|
|
80
|
-
3) To build JSXGraph run `$ make core` which will output an unminified version
|
|
80
|
+
3) To build JSXGraph run `$ make core` which will output an unminified version ```jsxgraphsrc.js``` and the minified version ```jsxgraphcore.js``` in ```distrib```.
|
|
81
81
|
|
|
82
82
|
|
|
83
83
|
License
|
|
84
84
|
-------
|
|
85
85
|
|
|
86
|
-
Copyright 2008-
|
|
86
|
+
Copyright 2008-2022
|
|
87
87
|
Matthias Ehmann,
|
|
88
88
|
Michael Gerhaeuser,
|
|
89
89
|
Carsten Miller,
|
package/distrib/README.md
CHANGED
|
@@ -77,13 +77,13 @@ dependencies required to build JSXGraph using npm in the JSXGraph root directory
|
|
|
77
77
|
This will create a new subdirectory ```node_modules``` in the JSXGraph root directory which holds
|
|
78
78
|
all tools and libraries required to build ```jsxgraphcore.js```.
|
|
79
79
|
|
|
80
|
-
3) To build JSXGraph run `$ make core` which will output an unminified version
|
|
80
|
+
3) To build JSXGraph run `$ make core` which will output an unminified version ```jsxgraphsrc.js``` and the minified version ```jsxgraphcore.js``` in ```distrib```.
|
|
81
81
|
|
|
82
82
|
|
|
83
83
|
License
|
|
84
84
|
-------
|
|
85
85
|
|
|
86
|
-
Copyright 2008-
|
|
86
|
+
Copyright 2008-2022
|
|
87
87
|
Matthias Ehmann,
|
|
88
88
|
Michael Gerhaeuser,
|
|
89
89
|
Carsten Miller,
|
package/distrib/geogebra.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
JSXGraph 1.
|
|
2
|
+
JSXGraph 1.4.1
|
|
3
3
|
|
|
4
|
-
Copyright 2008-
|
|
4
|
+
Copyright 2008-2022
|
|
5
5
|
Matthias Ehmann,
|
|
6
6
|
Michael Gerhaeuser,
|
|
7
7
|
Carsten Miller,
|
|
@@ -58,4 +58,4 @@
|
|
|
58
58
|
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
59
59
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
60
60
|
*/
|
|
61
|
-
(function(){"use strict";JXG.GeogebraReader=function(board,str){var tree,content;content=this.prepareString(str);tree=JXG.XML.parse(content);this.tree=tree;this.board=board;this.ggbElements=[];this.board.ggb={};this.format=parseFloat(tree.getElementsByTagName("geogebra")[0].getAttribute("format"));this.decimals=parseInt(tree.getElementsByTagName("geogebra")[0].getElementsByTagName("kernel")[0].getElementsByTagName("decimals")[0].getAttribute("val"),10)};JXG.extend(JXG.GeogebraReader.prototype,{ggbAct:function(type,m,n){var s1,s2,a,regexValue=new RegExp("JXG\\.boards\\['"+this.board.id+'\'\\].select\\("(.+?)"\\)\\.'),regexSelect=new RegExp("JXG\\.boards\\['"+this.board.id+"'\\].select"),v1=m,v2=n;switch(type.toLowerCase()){case"end":return v1;case"coord":s1=this.ggbElements[v1]?"JXG.boards['"+this.board.id+"'].select('"+v1+"')":v1;s2=this.ggbElements[v2]?"JXG.boards['"+this.board.id+"'].select('"+v2+"')":v2;return[s1,s2];case"le":return"( ("+v1+") <= ("+v2+") )";case"ge":return"( ("+v1+") >= ("+v2+") )";case"eq":return"( ("+v1+") == ("+v2+") )";case"neq":return"( ("+v1+") != ("+v2+") )";case"lt":return"( ("+v1+") < ("+v2+") )";case"gt":return"( ("+v1+") > ("+v2+") )";case"add":if(this.isGGBVector(v1)&&this.isGGBVector(v2)){return[1,v1[1]+"+"+v2[1],v1[2]+"+"+v2[2]]}if(JXG.isString(v1)&&!v1.match(regexValue)&&v1.match(regexSelect)){s1=[v1+".X()",v1+".Y()"]}else{s1=v1}if(JXG.isString(v2)&&!v2.match(regexValue)&&v2.match(regexSelect)){s2=[v2+".X()",v2+".Y()"]}else{s2=v2}if(this.isGGBVector(s1)&&JXG.isArray(s2)){return[s1[1]+"+"+s2[0],s1[2]+"+"+s2[1]]}if(this.isGGBVector(s2)&&JXG.isArray(s1)){return[s2[1]+"+"+s1[0],s2[2]+"+"+s1[1]]}if(JXG.isArray(s1)&&JXG.isArray(s2)){return[s1[0]+" + "+s2[0],s1[1]+" + "+s2[1]]}if((JXG.isNumber(s1)||JXG.isString(s1))&&(JXG.isNumber(s2)||JXG.isString(s2))){return s1+" + "+s2}if((JXG.isNumber(s1)||JXG.isString(s1))&&JXG.isArray(s2)){return[s1+" + "+s2[0],s1+" + "+s2[1]]}if(JXG.isArray(s1)&&(JXG.isNumber(s2)||JXG.isString(s2))){return[s1[0]+" + "+s2,s1[1]+" + "+s2]}return s1+" + "+s2;case"sub":if(this.isGGBVector(v1)&&this.isGGBVector(v2)){return[1,v1[1]+"-"+v2[1],v1[2]+"-"+v2[2]]}if(JXG.isString(v1)&&!v1.match(regexValue)&&v1.match(regexSelect)){s1=[v1+".X()",v1+".Y()"]}else{s1=v1}if(JXG.isString(v2)&&!v2.match(regexValue)&&v2.match(regexSelect)){s2=[v2+".X()",v2+".Y()"]}else{s2=v2}if(this.isGGBVector(s1)&&JXG.isArray(s2)){return[s1[1]+"-"+s2[0],s1[2]+"-"+s2[1]]}if(JXG.isArray(s1)&&this.isGGBVector(s2)){return[s1[0]+"-("+s2[1]+")",s1[1]+"-("+s2[2]+")"]}if(JXG.isArray(s1)&&JXG.isArray(s2)){return[s1[0]+" - "+s2[0],s1[1]+" - "+s2[1]]}if((JXG.isNumber(s1)||JXG.isString(s1))&&(JXG.isNumber(s2)||JXG.isString(s2))){return s1+" - "+s2}if((JXG.isNumber(s1)||JXG.isString(s1))&&JXG.isArray(s2)){return[s1+" - "+s2[0],s1+" - "+s2[1]]}if(JXG.isArray(s1)&&(JXG.isNumber(s2)||JXG.isString(s2))){return[s1[0]+" - "+s2,s1[1]+" - "+s2]}return s1+" - "+s2;case"neg":return"!("+v1+")";case"pow":return"Math.pow("+v1+", "+v2+")";case"or":return"("+v1+"||"+v2+")";case"and":return"("+v1+"&&"+v2+")";case"mul":if(this.isGGBVector(v1)&&!JXG.isArray(v2)){return[1,"("+v1[1]+")*"+v2,"("+v1[2]+")*"+v2]}if(!JXG.isArray(v1)&&this.isGGBVector(v2)){return[1,"("+v2[1]+")*"+v1,"("+v2[2]+")*"+v1]}if(this.isGGBVector(v1)&&this.isGGBVector(v2)){return"(("+v1[1]+")*("+v2[1]+")+("+v1[2]+")*("+v2[2]+"))"}if(JXG.isString(v1)&&!v1.match(regexValue)&&v1.match(regexSelect)){s1=[v1+".X()",v1+".Y()"]}else{s1=v1}if(JXG.isString(v2)&&!v2.match(regexValue)&&v2.match(regexSelect)){s2=[v2+".X()",v2+".Y()"]}else{s2=v2}if(JXG.isArray(s1)&&JXG.isArray(s2)){return[s1[0]+" * "+s2[0],s1[1]+" * "+s2[1]]}if((JXG.isNumber(s1)||JXG.isString(s1))&&(JXG.isNumber(s2)||JXG.isString(s2))){return s1+" * "+s2}if((JXG.isNumber(s1)||JXG.isString(s1))&&JXG.isArray(s2)){return[s1+" * "+s2[0],s1+" * "+s2[1]]}if(JXG.isArray(s1)&&(JXG.isNumber(s2)||JXG.isString(s2))){return[s1[0]+" * "+s2,s1[1]+" * "+s2]}return s1+" * "+s2;case"div":if(JXG.isString(v1)&&!v1.match(regexValue)&&v1.match(regexSelect)){s1=[v1+".X()",v1+".Y()"]}else{s1=v1}if(JXG.isString(v2)&&!v2.match(regexValue)&&v2.match(regexSelect)){s2=[v2+".X()",v2+".Y()"]}else{s2=v2}if(JXG.isArray(s1)&&JXG.isArray(s2)){return[s1[0]+" / "+s2[0],s1[1]+" / "+s2[1]]}if((JXG.isNumber(s1)||JXG.isString(s1))&&(JXG.isNumber(s2)||JXG.isString(s2))){return s1+" / "+s2}if((JXG.isNumber(s1)||JXG.isString(s1))&&JXG.isArray(s2)){return[s1+" / "+s2[0],s1+" / "+s2[1]]}if(JXG.isArray(s1)&&(JXG.isNumber(s2)||JXG.isString(s2))){return[s1[0]+" / "+s2,s1[1]+" / "+s2]}return s1+" / "+s2;case"negmult":if(this.isGGBVector(v1)){return[1,-1+"*"+v1[1],-1+"*"+v1[2]]}return-1+"*"+v1;case"bra":if(this.isGGBVector(v1)){return[1,"("+v1[1]+")","("+v1[2]+")"]}return"("+v1+")";case"int":return parseInt(v1,10);case"float":return parseFloat(v1);case"param":return v1;case"html":return v1;case"string":if(v2){return[v1,v2]}return v1;case"command":v2=v1.split("[");s1=v2[0];s2=v2[1].split("]")[0];if(s1.toLowerCase()==="name"){return"JXG.boards['"+this.board.id+"'].select('"+s2+"').getName()"}break;case"var":if(v2){switch(v1.toLowerCase()){case"x":return v2+".X()";case"y":return v2+".Y()";case"abs":case"acos":case"asin":case"atan":case"ceil":case"cos":case"exp":case"floor":case"log":case"max":case"min":case"pow":case"random":case"round":case"sin":case"sqrt":case"tan":return"Math."+v1.toLowerCase()+"("+v2+")";default:return v1.toLowerCase()+"*("+v2+")"}}else{if(v1==="PI"){return"Math.PI"}a=this.checkElement(v1);if(JXG.exists(this.board.ggb[v1])){return"JXG.boards['"+this.board.id+"'].ggb[\""+v1+'"]()'}if(JXG.exists(a.Value)){return"JXG.boards['"+this.board.id+"'].select(\""+v1+'").Value()'}if(JXG.exists(a.Area)){return"JXG.boards['"+this.board.id+"'].select(\""+v1+'").Area()'}if(JXG.exists(a.plaintextStr)){return"1.0*JXG.boards['"+this.board.id+"'].select(\""+v1+'").plaintextStr'}if(a.type===JXG.OBJECT_TYPE_VECTOR){return[1,"JXG.boards['"+this.board.id+"'].select(\""+v1+"\").point2.X()-JXG.boards['"+this.board.id+"'].select(\""+v1+'").point1.X()',"JXG.boards['"+this.board.id+"'].select(\""+v1+"\").point2.Y()-JXG.boards['"+this.board.id+"'].select(\""+v1+'").point1.Y()']}if(a.elementClass===JXG.OBJECT_CLASS_LINE){return"JXG.boards['"+this.board.id+"'].select(\""+v1+"\").point1.Dist(JXG.boards['"+this.board.id+"'].select(\""+v1+'").point2)'}return"JXG.boards['"+this.board.id+"'].select(\""+v1+'")'}}},ggbParse:function(exp,el){var i,error_count,error_offsets=[],error_lookaheads=[],errstr="",str=exp,dbg_withtrace=false,dbg_string="",ggbr=this,element=el?this.board.select(this.ggbElements[el].id):false;if(element){JXG.debug("Update element: "+element.name+"("+element.id+")")}function dbg_print(text){dbg_string+=text+"\n"}function lex(info){var state=0,match=-1,match_pos=0,start=0,pos=info.offset+1;do{pos-=1;state=0;match=-2;start=pos;if(info.src.length<=start){return 28}do{switch(state){case 0:if(info.src.charCodeAt(pos)===9||info.src.charCodeAt(pos)===32){state=1}else if(info.src.charCodeAt(pos)===33){state=2}else if(info.src.charCodeAt(pos)===40){state=3}else if(info.src.charCodeAt(pos)===41){state=4}else if(info.src.charCodeAt(pos)===42){state=5}else if(info.src.charCodeAt(pos)===43){state=6}else if(info.src.charCodeAt(pos)===44){state=7}else if(info.src.charCodeAt(pos)===45){state=8}else if(info.src.charCodeAt(pos)===47){state=9}else if(info.src.charCodeAt(pos)>=48&&info.src.charCodeAt(pos)<=57){state=10}else if(info.src.charCodeAt(pos)===60){state=11}else if(info.src.charCodeAt(pos)===62){state=12}else if(info.src.charCodeAt(pos)>=65&&info.src.charCodeAt(pos)<=90||info.src.charCodeAt(pos)>=97&&info.src.charCodeAt(pos)<=122){state=13}else if(info.src.charCodeAt(pos)===94){state=14}else if(info.src.charCodeAt(pos)===34){state=26}else if(info.src.charCodeAt(pos)===38){state=28}else if(info.src.charCodeAt(pos)===46){state=29}else if(info.src.charCodeAt(pos)===61){state=30}else if(info.src.charCodeAt(pos)===95){state=31}else if(info.src.charCodeAt(pos)===124){state=32}else{state=-1}break;case 1:state=-1;match=1;match_pos=pos;break;case 2:if(info.src.charCodeAt(pos)===61){state=15}else{state=-1}match=23;match_pos=pos;break;case 3:state=-1;match=2;match_pos=pos;break;case 4:state=-1;match=3;match_pos=pos;break;case 5:state=-1;match=13;match_pos=pos;break;case 6:state=-1;match=11;match_pos=pos;break;case 7:state=-1;match=16;match_pos=pos;break;case 8:state=-1;match=12;match_pos=pos;break;case 9:state=-1;match=14;match_pos=pos;break;case 10:if(info.src.charCodeAt(pos)>=48&&info.src.charCodeAt(pos)<=57){state=10}else if(info.src.charCodeAt(pos)===46){state=18}else{state=-1}match=4;match_pos=pos;break;case 11:if(info.src.charCodeAt(pos)===61){state=19}else{state=-1}match=21;match_pos=pos;break;case 12:if(info.src.charCodeAt(pos)===61){state=21}else{state=-1}match=22;match_pos=pos;break;case 13:if(info.src.charCodeAt(pos)>=65&&info.src.charCodeAt(pos)<=90||info.src.charCodeAt(pos)>=97&&info.src.charCodeAt(pos)<=122){state=13}else if(info.src.charCodeAt(pos)>=48&&info.src.charCodeAt(pos)<=57){state=27}else if(info.src.charCodeAt(pos)===91){state=34}else if(info.src.charCodeAt(pos)===95){state=35}else{state=-1}match=7;match_pos=pos;break;case 14:state=-1;match=15;match_pos=pos;break;case 15:state=-1;match=20;match_pos=pos;break;case 16:state=-1;match=9;match_pos=pos;break;case 17:state=-1;match=25;match_pos=pos;break;case 18:if(info.src.charCodeAt(pos)>=48&&info.src.charCodeAt(pos)<=57){state=18}else{state=-1}match=5;match_pos=pos;break;case 19:state=-1;match=17;match_pos=pos;break;case 20:state=-1;match=19;match_pos=pos;break;case 21:state=-1;match=18;match_pos=pos;break;case 22:state=-1;match=24;match_pos=pos;break;case 23:state=-1;match=8;match_pos=pos;break;case 24:if(info.src.charCodeAt(pos)>=48&&info.src.charCodeAt(pos)<=57||info.src.charCodeAt(pos)>=65&&info.src.charCodeAt(pos)<=90||info.src.charCodeAt(pos)>=97&&info.src.charCodeAt(pos)<=122){state=24}else{state=-1}match=6;match_pos=pos;break;case 25:state=-1;match=10;match_pos=pos;break;case 26:if(info.src.charCodeAt(pos)===34){state=16}else if(info.src.charCodeAt(pos)===32||info.src.charCodeAt(pos)===46||info.src.charCodeAt(pos)>=48&&info.src.charCodeAt(pos)<=57||info.src.charCodeAt(pos)===61||info.src.charCodeAt(pos)>=65&&info.src.charCodeAt(pos)<=90||info.src.charCodeAt(pos)>=97&&info.src.charCodeAt(pos)<=122||info.src.charCodeAt(pos)===223||info.src.charCodeAt(pos)===228||info.src.charCodeAt(pos)===246||info.src.charCodeAt(pos)===252){state=26}else{state=-1}break;case 27:if(info.src.charCodeAt(pos)>=48&&info.src.charCodeAt(pos)<=57||info.src.charCodeAt(pos)>=65&&info.src.charCodeAt(pos)<=90||info.src.charCodeAt(pos)>=97&&info.src.charCodeAt(pos)<=122){state=27}else if(info.src.charCodeAt(pos)===95){state=35}else{state=-1}match=7;match_pos=pos;break;case 28:if(info.src.charCodeAt(pos)===38){state=17}else if(info.src.charCodeAt(pos)>=65&&info.src.charCodeAt(pos)<=90||info.src.charCodeAt(pos)>=97&&info.src.charCodeAt(pos)<=122){state=33}else{state=-1}break;case 29:if(info.src.charCodeAt(pos)>=48&&info.src.charCodeAt(pos)<=57){state=18}else{state=-1}break;case 30:if(info.src.charCodeAt(pos)===61){state=20}else{state=-1}break;case 31:if(info.src.charCodeAt(pos)===95){state=36}else{state=-1}break;case 32:if(info.src.charCodeAt(pos)===124){state=22}else{state=-1}break;case 33:if(info.src.charCodeAt(pos)===59){state=23}else if(info.src.charCodeAt(pos)>=65&&info.src.charCodeAt(pos)<=90||info.src.charCodeAt(pos)>=97&&info.src.charCodeAt(pos)<=122){state=33}else{state=-1}break;case 34:if(info.src.charCodeAt(pos)>=65&&info.src.charCodeAt(pos)<=90||info.src.charCodeAt(pos)>=97&&info.src.charCodeAt(pos)<=122){state=37}else{state=-1}break;case 35:if(info.src.charCodeAt(pos)>=48&&info.src.charCodeAt(pos)<=57||info.src.charCodeAt(pos)>=65&&info.src.charCodeAt(pos)<=90||info.src.charCodeAt(pos)>=97&&info.src.charCodeAt(pos)<=122){state=27}else if(info.src.charCodeAt(pos)===95){state=35}else{state=-1}break;case 36:if(info.src.charCodeAt(pos)>=48&&info.src.charCodeAt(pos)<=57||info.src.charCodeAt(pos)>=65&&info.src.charCodeAt(pos)<=90||info.src.charCodeAt(pos)>=97&&info.src.charCodeAt(pos)<=122){state=24}else{state=-1}break;case 37:if(info.src.charCodeAt(pos)===93){state=25}else if(info.src.charCodeAt(pos)>=65&&info.src.charCodeAt(pos)<=90||info.src.charCodeAt(pos)>=97&&info.src.charCodeAt(pos)<=122){state=37}else{state=-1}break}pos+=1}while(state>-1)}while(1>-1&&match===1);if(match>-1){info.att=info.src.substr(start,match_pos-start);info.offset=match_pos}else{info.att="";match=-1}return match}function parse(src,err_off,err_la){var i,act,go,la,rval,rvstack,rsstack,undef,act_tab,pop_tab,goto_tab,labels,sstack=[],vstack=[],err_cnt=0,info={};pop_tab=[[0,1],[27,1],[26,5],[26,3],[26,3],[26,3],[26,3],[26,3],[26,3],[26,3],[26,3],[26,2],[26,3],[26,3],[26,3],[26,3],[26,3],[26,2],[26,3],[26,3],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,4],[26,1]];act_tab=[[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[28,0],[14,13,13,14,25,15,24,16,15,17,12,18,11,19,22,20,21,21,20,22,19,23,18,24,17,25,28,-1],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[11,29,28,-24,17,-24,18,-24,19,-24,20,-24,21,-24,22,-24,12,-24,15,-24,24,-24,25,-24,13,-24,14,-24,16,-24,3,-24],[28,-20,17,-20,18,-20,19,-20,20,-20,21,-20,22,-20,11,-20,12,-20,15,-20,24,-20,25,-20,13,-20,14,-20,16,-20,3,-20],[28,-21,17,-21,18,-21,19,-21,20,-21,21,-21,22,-21,11,-21,12,-21,15,-21,24,-21,25,-21,13,-21,14,-21,16,-21,3,-21],[28,-22,17,-22,18,-22,19,-22,20,-22,21,-22,22,-22,11,-22,12,-22,15,-22,24,-22,25,-22,13,-22,14,-22,16,-22,3,-22],[28,-23,17,-23,18,-23,19,-23,20,-23,21,-23,22,-23,11,-23,12,-23,15,-23,24,-23,25,-23,13,-23,14,-23,16,-23,3,-23],[28,-25,17,-25,18,-25,19,-25,20,-25,21,-25,22,-25,11,-25,12,-25,15,-25,24,-25,25,-25,13,-25,14,-25,16,-25,3,-25],[2,30,28,-27,17,-27,18,-27,19,-27,20,-27,21,-27,22,-27,11,-27,12,-27,15,-27,24,-27,25,-27,13,-27,14,-27,16,-27,3,-27],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[14,13,13,14,25,15,24,16,15,17,12,18,11,19,22,20,21,21,20,22,19,23,18,24,17,25,16,44,3,45],[14,-11,13,-11,25,15,24,16,15,-11,12,-11,11,-11,22,-11,21,-11,20,-11,19,-11,18,-11,17,-11,28,-11,16,-11,3,-11],[14,-17,13,-17,25,15,24,16,15,17,12,-17,11,-17,22,20,21,21,20,22,19,23,18,24,17,25,28,-17,16,-17,3,-17],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[14,-16,13,-16,25,15,24,16,15,17,12,-16,11,-16,22,20,21,21,20,22,19,23,18,24,17,25,28,-16,16,-16,3,-16],[14,-15,13,-15,25,15,24,16,15,17,12,-15,11,-15,22,20,21,21,20,22,19,23,18,24,17,25,28,-15,16,-15,3,-15],[14,-14,13,-14,25,-14,24,-14,15,-14,12,-14,11,-14,22,-14,21,-14,20,-14,19,-14,18,-14,17,-14,28,-14,16,-14,3,-14],[14,-13,13,-13,25,-13,24,-13,15,-13,12,-13,11,-13,22,-13,21,-13,20,-13,19,-13,18,-13,17,-13,28,-13,16,-13,3,-13],[14,-12,13,-12,25,15,24,16,15,-12,12,-12,11,-12,22,20,21,21,20,22,19,23,18,24,17,25,28,-12,16,-12,3,-12],[14,13,13,14,25,15,24,16,15,17,12,-10,11,-10,22,20,21,21,20,22,19,23,18,24,17,25,28,-10,16,-10,3,-10],[14,13,13,14,25,15,24,16,15,17,12,-9,11,-9,22,20,21,21,20,22,19,23,18,24,17,25,28,-9,16,-9,3,-9],[14,-8,13,-8,25,15,24,16,15,-8,12,-8,11,-8,22,-8,21,-8,20,-8,19,-8,18,-8,17,-8,28,-8,16,-8,3,-8],[14,-7,13,-7,25,15,24,16,15,-7,12,-7,11,-7,22,-7,21,-7,20,-7,19,-7,18,-7,17,-7,28,-7,16,-7,3,-7],[14,-6,13,-6,25,15,24,16,15,-6,12,-6,11,-6,22,-6,21,-6,20,-6,19,-6,18,-6,17,-6,28,-6,16,-6,3,-6],[14,-5,13,-5,25,15,24,16,15,-5,12,-5,11,-5,22,-5,21,-5,20,-5,19,-5,18,-5,17,-5,28,-5,16,-5,3,-5],[14,-4,13,-4,25,15,24,16,15,-4,12,-4,11,-4,22,-4,21,-4,20,-4,19,-4,18,-4,17,-4,28,-4,16,-4,3,-4],[14,-3,13,-3,25,15,24,16,15,-3,12,-3,11,-3,22,-3,21,-3,20,-3,19,-3,18,-3,17,-3,28,-3,16,-3,3,-3],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[28,-18,17,-18,18,-18,19,-18,20,-18,21,-18,22,-18,11,-18,12,-18,15,-18,24,-18,25,-18,13,-18,14,-18,16,-18,3,-18],[14,13,13,14,25,15,24,16,15,17,12,-19,11,-19,22,20,21,21,20,22,19,23,18,24,17,25,28,-19,16,-19,3,-19],[14,13,13,14,25,15,24,16,15,17,12,18,11,19,22,20,21,21,20,22,19,23,18,24,17,25,3,49],[14,13,13,14,25,15,24,16,15,17,12,18,11,19,22,20,21,21,20,22,19,23,18,24,17,25,3,50],[28,-26,17,-26,18,-26,19,-26,20,-26,21,-26,22,-26,11,-26,12,-26,15,-26,24,-26,25,-26,13,-26,14,-26,16,-26,3,-26],[28,-2,17,-2,18,-2,19,-2,20,-2,21,-2,22,-2,11,-2,12,-2,15,-2,24,-2,25,-2,13,-2,14,-2,16,-2,3,-2]];goto_tab=[[27,1,26,2],[],[],[26,26],[26,27],[26,28],[],[],[],[],[],[],[],[26,31],[26,32],[26,33],[26,34],[26,35],[26,36],[26,37],[26,38],[26,39],[26,40],[26,41],[26,42],[26,43],[],[],[],[26,46],[26,47],[],[],[],[],[],[],[],[],[],[],[],[],[],[26,48],[],[],[],[],[],[]];labels=["p'","WHITESPACE","(",")","INT","FLOAT","PARAM","VAR","HTML","STRING","COMMAND","+","-","*","/","^",",","<=",">=","==","!=","<",">","!","||","&&","e","p","$$"];info.offset=0;info.src=src;info.att="";if(!err_off){err_off=[]}if(!err_la){err_la=[]}sstack.push(0);vstack.push(0);la=lex(info);while(true){act=52;for(i=0;i<act_tab[sstack[sstack.length-1]].length;i+=2){if(act_tab[sstack[sstack.length-1]][i]===la){act=act_tab[sstack[sstack.length-1]][i+1];break}}if(dbg_withtrace&&sstack.length>0){dbg_print("\nState "+sstack[sstack.length-1]+"\n"+"\tLookahead: "+labels[la]+" ('"+info.att+"')\n"+"\tAction: "+act+"\n"+"\tSource: '"+info.src.substr(info.offset,30)+(info.offset+30<info.src.length?"...":"")+"'\n"+"\tStack: "+sstack.join()+"\n"+"\tValue stack: "+vstack.join()+"\n")}if(act===52){if(dbg_withtrace){dbg_print("Error detected: There is no reduce or shift on the symbol "+labels[la])}err_cnt+=1;err_off.push(info.offset-info.att.length);err_la.push([]);for(i=0;i<act_tab[sstack[sstack.length-1]].length;i+=2){err_la[err_la.length-1].push(labels[act_tab[sstack[sstack.length-1]][i]])}rsstack=[];rvstack=[];for(i=0;i<sstack.length;i++){rsstack[i]=sstack[i];rvstack[i]=vstack[i]}while(act===52&&la!==28){if(dbg_withtrace){dbg_print("\tError recovery\n"+"Current lookahead: "+labels[la]+" ("+info.att+")\n"+"Action: "+act+"\n\n")}if(la===-1){info.offset+=1}while(act===52&&sstack.length>0){sstack.pop();vstack.pop();if(sstack.length===0){break}act=52;for(i=0;i<act_tab[sstack[sstack.length-1]].length;i+=2){if(act_tab[sstack[sstack.length-1]][i]===la){act=act_tab[sstack[sstack.length-1]][i+1];break}}}if(act!==52){break}for(i=0;i<rsstack.length;i++){sstack.push(rsstack[i]);vstack.push(rvstack[i])}la=lex(info)}if(act===52){if(dbg_withtrace){dbg_print("\tError recovery failed, terminating parse process...")}break}if(dbg_withtrace){dbg_print("\tError recovery succeeded, continuing")}}if(act>0){if(dbg_withtrace){dbg_print("Shifting symbol: "+labels[la]+" ("+info.att+")")}sstack.push(act);vstack.push(info.att);la=lex(info);if(dbg_withtrace){dbg_print("\tNew lookahead symbol: "+labels[la]+" ("+info.att+")")}}else{act*=-1;if(dbg_withtrace){dbg_print("Reducing by producution: "+act)}rval=undef;if(dbg_withtrace){dbg_print("\tPerforming semantic action...")}switch(act){case 0:rval=vstack[vstack.length-1];break;case 1:rval=ggbr.ggbAct("end",vstack[vstack.length-1]);break;case 2:rval=ggbr.ggbAct("coord",vstack[vstack.length-4],vstack[vstack.length-2],element);break;case 3:rval=ggbr.ggbAct("le",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 4:rval=ggbr.ggbAct("ge",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 5:rval=ggbr.ggbAct("eq",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 6:rval=ggbr.ggbAct("neq",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 7:rval=ggbr.ggbAct("lt",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 8:rval=ggbr.ggbAct("gt",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 9:rval=ggbr.ggbAct("add",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 10:rval=ggbr.ggbAct("sub",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 11:rval=ggbr.ggbAct("neg",vstack[vstack.length-1]);break;case 12:rval=ggbr.ggbAct("pow",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 13:rval=ggbr.ggbAct("or",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 14:rval=ggbr.ggbAct("and",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 15:rval=ggbr.ggbAct("mul",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 16:rval=ggbr.ggbAct("div",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 17:rval=ggbr.ggbAct("negmult",vstack[vstack.length-1]);break;case 18:rval=ggbr.ggbAct("bra",vstack[vstack.length-2]);break;case 19:rval=ggbr.ggbAct("string",vstack[vstack.length-3],vstack[vstack.length-1]);break;case 20:rval=ggbr.ggbAct("int",vstack[vstack.length-1]);break;case 21:rval=ggbr.ggbAct("float",vstack[vstack.length-1]);break;case 22:rval=ggbr.ggbAct("param",vstack[vstack.length-1]);break;case 23:rval=ggbr.ggbAct("html",vstack[vstack.length-1]);break;case 24:rval=ggbr.ggbAct("string",vstack[vstack.length-1]);break;case 25:rval=ggbr.ggbAct("command",vstack[vstack.length-1]);break;case 26:rval=ggbr.ggbAct("var",vstack[vstack.length-4],vstack[vstack.length-2]);break;case 27:rval=ggbr.ggbAct("var",vstack[vstack.length-1]);break}if(dbg_withtrace){dbg_print("\tPopping "+pop_tab[act][1]+" off the stack...")}for(i=0;i<pop_tab[act][1];i++){sstack.pop();str=vstack.pop()}go=-1;for(i=0;i<goto_tab[sstack[sstack.length-1]].length;i+=2){if(goto_tab[sstack[sstack.length-1]][i]===pop_tab[act][0]){go=goto_tab[sstack[sstack.length-1]][i+1];break}}if(act===0){break}if(dbg_withtrace){dbg_print("\tPushing non-terminal "+labels[pop_tab[act][0]])}sstack.push(go);vstack.push(rval)}if(dbg_withtrace){JXG.debug(dbg_string);dbg_string=""}}if(dbg_withtrace){dbg_print("\nParse complete.");JXG.debug(dbg_string)}return err_cnt}if((error_count=parse(str,error_offsets,error_lookaheads))>0){for(i=0;i<error_count;i++){errstr+="Parse error in line "+(str.substr(0,error_offsets[i]).match(/\n/g)?str.substr(0,error_offsets[i]).match(/\n/g).length:1)+" near '"+str.substr(error_offsets[i])+"', expecting '"+error_lookaheads[i].join()+"'\n"}JXG.debug(errstr)}return str},setDefaultOptions:function(){this.board.options.elements.strokeWidth=1;this.board.options.elements.withLabel=true;this.board.options.point.face="circle";this.board.options.point.size=3;this.board.options.point.fillColor="blue";this.board.options.point.fillOpacity=1;this.board.options.point.highlightFillOpacity=1;this.board.options.point.strokeColor="black";this.board.options.point.highlightStrokeColor="black";this.board.options.point.strokeWidth=2;this.board.options.line.strokeWidth=1;this.board.options.line.highlightStrokeColor="#000000";this.board.options.line.strokeColor="#000000";this.board.options.polygon.fillColor=JXG.rgb2hex(153,51,0);this.board.options.polygon.fillOpacity=.1;this.board.options.polygon.highlightFillColor=this.board.options.polygon.fillColor;this.board.options.polygon.highlightFillOpacity=.1;this.board.options.sector.fillColor=JXG.rgb2hex(153,51,0);this.board.options.sector.fillOpacity=.1;this.board.options.sector.highlightFillColor=this.board.options.sector.fillColor;this.board.options.sector.highlightFillOpacity=.1;this.board.options.angle.fillColor=JXG.rgb2hex(0,100,0);this.board.options.angle.fillOpacity=.1;this.board.options.angle.highlightFillOpacity=.1},colorProperties:function(Data,attr){var a,r,g,b,objColor=Data.getElementsByTagName("objColor")[0],len=Data.getElementsByTagName("objColor").length>0;a=len&&objColor.getAttribute("alpha")?parseFloat(objColor.getAttribute("alpha")):0;r=len&&objColor.getAttribute("r")?parseInt(objColor.getAttribute("r"),10).toString(16):0;g=len&&objColor.getAttribute("g")?parseInt(objColor.getAttribute("g"),10).toString(16):0;b=len&&objColor.getAttribute("b")?parseInt(objColor.getAttribute("b"),10).toString(16):0;if(r.length===1){r="0"+r}if(g.length===1){g="0"+g}if(b.length===1){b="0"+b}attr.fillColor="#"+r+g+b;attr.strokeColor=attr.fillColor;attr.highlightFillColor=attr.fillColor;attr.highlightStrokeColor=attr.strokeColor;attr.fillOpacity=a;attr.highlightFillOpacity=a;attr.labelColor=attr.fillColor;return attr},boardProperties:function(gxtEl,Data,attr){return attr},coordinates:function(gxtEl,Data){var a,tmp,labelOffset={x:0,y:0,z:0};if(Data.getElementsByTagName("labelOffset")[0]){labelOffset.x=parseFloat(Data.getElementsByTagName("labelOffset")[0].getAttribute("x"))/this.board.unitX;labelOffset.y=parseFloat(Data.getElementsByTagName("labelOffset")[0].getAttribute("y"))/this.board.unitY}if(Data.getElementsByTagName("coords")[0]){gxtEl.x=parseFloat(Data.getElementsByTagName("coords")[0].getAttribute("x"));gxtEl.y=parseFloat(Data.getElementsByTagName("coords")[0].getAttribute("y"));gxtEl.z=parseFloat(Data.getElementsByTagName("coords")[0].getAttribute("z"))}else if(Data.getElementsByTagName("startPoint")[0]){if(Data.getElementsByTagName("startPoint")[0].getAttribute("exp")){a=this.board.select(Data.getElementsByTagName("startPoint")[0].getAttribute("exp"));gxtEl.x=function(){return a.X()+labelOffset.x};gxtEl.y=function(){return a.Y()-labelOffset.y};gxtEl.z=false}else{gxtEl.x=parseFloat(Data.getElementsByTagName("startPoint")[0].getAttribute("x"));gxtEl.y=parseFloat(Data.getElementsByTagName("startPoint")[0].getAttribute("y"));gxtEl.z=parseFloat(Data.getElementsByTagName("startPoint")[0].getAttribute("z"))}}else if(Data.getElementsByTagName("absoluteScreenLocation")[0]){tmp=new JXG.Coords(JXG.COORDS_BY_SCREEN,[parseFloat(Data.getElementsByTagName("absoluteScreenLocation")[0].getAttribute("x")),parseFloat(Data.getElementsByTagName("absoluteScreenLocation")[0].getAttribute("y"))],this.board);gxtEl.x=tmp.usrCoords[1]+labelOffset.x;gxtEl.y=tmp.usrCoords[2]+labelOffset.y;gxtEl.z=false}else{return false}return gxtEl},visualProperties:function(Data,attr){var show=Data.getElementsByTagName("show"),pointSize=Data.getElementsByTagName("pointSize"),pointStyle=Data.getElementsByTagName("pointStyle"),slopeTriangleSize=Data.getElementsByTagName("slopeTriangleSize"),lineStyle=Data.getElementsByTagName("lineStyle"),labelOffset=Data.getElementsByTagName("labelOffset"),trace=Data.getElementsByTagName("trace"),fix=Data.getElementsByTagName("fix");if(show.length>0&&show[0].getAttribute("object")){attr.visible=JXG.str2Bool(show[0].getAttribute("object"))}if(show.length>0&&show[0].getAttribute("label")){attr.withLabel=JXG.str2Bool(show[0].getAttribute("label"))}if(pointSize.length>0&&pointSize[0].getAttribute("val")){attr.size=parseInt(pointSize[0].getAttribute("val"),10)}if(pointStyle.length>0&&pointStyle[0].getAttribute("val")){attr.styleGGB=parseInt(pointStyle[0].getAttribute("val"),10)}if(attr.styleGGB===0||attr.styleGGB===2){attr.face="circle";if(attr.styleGGB===0){attr.fillColor=attr.strokeColor;attr.fillOpacity=1;attr.highlightFillColor=attr.strokeColor;attr.highlightFillOpacity=1;attr.strokeColor="black";attr.strokeWidth=1}else if(attr.styleGGB===2){attr.fillColor="none"}}else if(attr.styleGGB===1){attr.face="x"}else if(attr.styleGGB===3){attr.face="+";attr.strokeOpacity=1}else if(attr.styleGGB===4||attr.styleGGB===5){attr.face="diamond";if(attr.styleGGB===4){attr.fillColor=attr.strokeColor;attr.fillOpacity=1}else if(attr.styleGGB===5){attr.fillColor="none"}}else if(attr.styleGGB===6){attr.face="triangleUp";attr.fillColor=attr.strokeColor;attr.fillOpacity=1}else if(attr.styleGGB===7){attr.face="triangleDown";attr.fillColor=attr.strokeColor;attr.fillOpacity=1}else if(attr.styleGGB===8){attr.face="triangleRight";attr.fillColor=attr.strokeColor;attr.fillOpacity=1}else if(attr.styleGGB===9){attr.face="triangleLeft";attr.fillColor=attr.strokeColor;attr.fillOpacity=1}if(slopeTriangleSize.length>0){attr.slopeWidth=slopeTriangleSize[0].getAttribute("val")}if(lineStyle.length>0){attr.strokeWidth=Math.round(parseFloat(lineStyle[0].getAttribute("thickness"))/2);attr.dashGGB=lineStyle[0].getAttribute("type")}if(attr.strokeWidth){attr.highlightStrokeWidth=attr.strokeWidth+1}if(attr.dashGGB==="0"){attr.dash=0}else if(attr.dashGGB==="10"){attr.dash=2}else if(attr.dashGGB==="15"){attr.dash=3}else if(attr.dashGGB==="20"){attr.dash=1}else if(attr.dashGGB==="30"){attr.dash=6}if(labelOffset.length>0){attr.labelX=parseFloat(labelOffset[0].getAttribute("x"));attr.labelY=parseFloat(labelOffset[0].getAttribute("y"))}if(trace.length>0){attr.trace=trace[0].getAttribute("val")}if(fix.length>0){attr.fixed=fix[0].getAttribute("val")}return attr},getElement:function(name,expr){var Data,i,j;expr=expr||false;for(i=0;i<this.tree.getElementsByTagName("construction").length;i++){if(expr===false){for(j=0;j<this.tree.getElementsByTagName("construction")[i].getElementsByTagName("element").length;j++){Data=this.tree.getElementsByTagName("construction")[i].getElementsByTagName("element")[j];if(name===Data.getAttribute("label")){return Data}}}else{for(j=0;j<this.tree.getElementsByTagName("construction")[i].getElementsByTagName("expression").length;j++){Data=this.tree.getElementsByTagName("construction")[i].getElementsByTagName("expression")[j];if(name===Data.getAttribute("label")){return Data}if(name===Data.getAttribute("exp")){return this.getElement(Data.getAttribute("label"))}}}}return false},checkElement:function(name){var input;if(!JXG.exists(this.ggbElements[name])||this.ggbElements[name]===""){input=this.getElement(name)||this.getElement(name,true);if(!input){var i,j,Data;var exp1=this.ggbParse(name);for(i=0;i<this.tree.getElementsByTagName("construction").length;i++){for(j=0;j<this.tree.getElementsByTagName("construction")[i].getElementsByTagName("expression").length;j++){Data=this.tree.getElementsByTagName("construction")[i].getElementsByTagName("expression")[j];var exp2=this.ggbParse(Data.getAttribute("exp"));if(JXG.isArray(exp1)&&JXG.isArray(exp2)){if(exp1[0]==exp2[0]&&exp1[1]==exp2[1]){input=this.getElement(Data.getAttribute("label"))}}}}if(!input){return new Function("return "+exp1+";")}}this.ggbElements[name]=this.writeElement(input)}return this.ggbElements[name]},functionParse:function(type,exp){var input,vars,expr,output,i,s,o;switch(type){case"c":if(exp.match(/[a-zA-Z0-9\']+\([a-zA-Z0-9]+[a-zA-Z0-9,\ ]*\)[\ ]*[=][\ ]*[a-zA-Z0-9\+\-\*\/ \( \) \u005E]+/)){input=exp.split("(")[1].split(")")[0];vars=input.split(", ");output=[];for(i=0;i<vars.length;i++){output.push("__"+vars[i])}expr=exp.split("=")[1];for(i=0;i<vars.length;i++){if(vars[i]==="x"){expr=expr.replace(/(?![e])x(?!\()(?![p])/g,"__"+vars[i])}else if(vars[i]==="y"){expr=expr.replace(/(?![e])y(?!\()(?![p])/g,"__"+vars[i])}else{expr=expr.replace(new RegExp(vars[i],"g"),"__"+vars[i])}}expr=expr.replace(/-__/g,"-1*__");if(this.format<=3.01){s=expr.split(" ");o="";for(i=0;i<s.length;i++){if(s.length!==i+1){if(s[i].search(/\)$/)>-1||s[i].search(/[0-9]+$/)>-1||s[i].search(/[a-zA-Z]+(_*[a-zA-Z0-9]+)*$/)>-1){if(s[i+1].search(/^\(/)>-1||s[i+1].search(/^[0-9]+/)>-1||s[i+1].search(/^[a-zA-Z]+(_*[a-zA-Z0-9]+)*/)>-1||s[i+1].search(/__[a-zA-Z0-9]+/)>-1){s[i]=s[i]+"*"}}}o+=s[i]}expr=o}output.push(expr);return output}return exp;case"s":exp=exp.replace(/(?![e])x(?!\()(?![p])/g,"__x");return["__x",exp];default:if(this.format<=3.01){s=exp.split(" ");o="";for(i=0;i<s.length;i++){if(s.length!==i+1){if(s[i].search(/\)$/)>-1||s[i].search(/[0-9]+$/)>-1||s[i].search(/[a-zA-Z]+(_*[a-zA-Z0-9]+)*$/)>-1){if(s[i+1].search(/^\(/)>-1||s[i+1].search(/^[0-9]+/)>-1||s[i+1].search(/^[a-zA-Z]+(\_*[a-zA-Z0-9]+)*/)>-1||s[i+1].search(/\_\_[a-zA-Z0-9]+/)>-1){s[i]=s[i]+"*"}}}o+=s[i]}exp=o}return exp}},writeBoard:function(){var grid,boardData=this.tree.getElementsByTagName("euclidianView")[0],coordSystem=boardData.getElementsByTagName("coordSystem")[0],gui=this.tree.getElementsByTagName("gui")[0],evSettings=boardData.getElementsByTagName("evSettings")[0];this.board.origin={};this.board.origin.usrCoords=[1,0,0];this.board.origin.scrCoords=[1,parseInt(coordSystem.getAttribute("xZero"),10),parseInt(coordSystem.getAttribute("yZero"),10)];this.board.unitX=coordSystem.getAttribute("scale")?parseInt(coordSystem.getAttribute("scale"),10):1;this.board.unitY=coordSystem.getAttribute("yscale")?parseInt(coordSystem.getAttribute("yscale"),10):this.board.unitX;this.board.fontSize=gui&&gui.getElementsByTagName("font")[0]?parseInt(gui.getElementsByTagName("font")[0].getAttribute("size"),10):12;JXG.boards[this.board.id]=this.board;this.board.renderer.enhancedRendering=true;grid=evSettings.getAttribute("grid")==="true"?this.board.create("grid"):null;if(evSettings.getAttribute("axes")){if(evSettings.getAttribute("axes")==="true"){this.ggbElements.xAxis=this.board.create("axis",[[0,0],[1,0]],{strokeColor:"transparent",minorTicks:0});this.ggbElements.yAxis=this.board.create("axis",[[0,0],[0,1]],{strokeColor:"black",minorTicks:0})}else{this.ggbElements.xAxis=this.board.create("axis",[[0,0],[1,0]],{strokeColor:"transparent",ticks:{drawLabels:false}});this.ggbElements.yAxis=this.board.create("axis",[[0,0],[0,1]],{strokeColor:"transparent",ticks:{drawLabels:false}})}}},writeElement:function(output,input,cmd){var p,res,re2,poly,t2,t,m,i,l2,p2,l1,p1,slopeWidth,tmp,attr2,t1,i2,i1,pol,type,d2,d1,d,startpoint,inp,borderatts,borders,element,gxtEl,attr,exp,coord,points,length,match,matchDep,rx,q,c,s,e,sx,sy,ex,ey,func,range,that=this,makeConstFun=function(a){return function(){return a}},makeRootFun=function(x){return function(){return JXG.Math.Numerics.root(inp.Y,x,inp)}};element=JXG.isArray(output)?output[0]:output;gxtEl={};attr={};JXG.debug(element);gxtEl.type=element&&element.attributes&&!JXG.exists(cmd)?element.getAttribute("type").toLowerCase():cmd;gxtEl.label=element.getAttribute("label");attr.name=gxtEl.label;JXG.debug("Constructing "+attr.name+"("+gxtEl.type+"):");switch(gxtEl.type){case"point":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);attr=this.visualProperties(element,attr);if(this.getElement(attr.name,true)){exp=this.getElement(attr.name,true).getAttribute("exp");coord=this.ggbParse(exp);gxtEl.x=new Function("return "+coord[0]+";");gxtEl.y=new Function("return "+coord[1]+";")}else{gxtEl=this.coordinates(gxtEl,element)}if(!JXG.exists(attr.styleGGB)){attr.face="circle";attr.fillColor=attr.strokeColor;attr.fillOpacity=1;attr.highlightFillColor=attr.strokeColor;attr.highlightFillOpacity=1;attr.strokeColor="black";attr.strokeWidth=1}JXG.debug(gxtEl);JXG.debug(input);try{match=/Circle\[\s*(\w+)\s*,\s*([\d\.]+)\s*\]/.exec(input);matchDep=/Circle\[\s*(\w+)\s*,\s*(\w+)\s*\]/.exec(input);if(JXG.exists(input)){if(JXG.exists(match)&&match.length===3){q=this.checkElement(match[1]);c=this.board.create("circle",[q,parseFloat(match[2])],{fillColor:"none",visible:false,name:""});p=this.board.create("glider",[gxtEl.x,gxtEl.y,c],attr)}else if(JXG.exists(matchDep)&&matchDep.length===3){q=this.checkElement(matchDep[1]);m=this.checkElement(matchDep[2]);c=this.board.create("circle",[q,function(){return m.Value()}],{fillColor:"none",visible:false,name:""});p=this.board.create("glider",[gxtEl.x,gxtEl.y,c],attr)}else if(JXG.isArray(input)){p=this.board.create("glider",[gxtEl.x,gxtEl.y,input[0]],attr)}else{p=this.board.create("glider",[gxtEl.x,gxtEl.y,input],attr)}}else{p=this.board.create("point",[gxtEl.x,gxtEl.y],attr)}return p}catch(exc1){JXG.debug("* Err: Point "+attr.name);return false}break;case"segment":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);if(typeof input==="undefined"){input=[parseFloat(element.getElementsByTagName("coords")[0].getAttribute("z")),parseFloat(element.getElementsByTagName("coords")[0].getAttribute("x")),parseFloat(element.getElementsByTagName("coords")[0].getAttribute("y"))]}else if(this.board.select(input[1].id).elementClass===JXG.OBJECT_CLASS_LINE){type="parallel"}try{JXG.debug("* Segment: ("+attr.name+") First: "+input[0].name+", Last: "+input[1].name);attr.straightFirst=false;attr.straightLast=false;p=this.board.create("line",input,attr);return p}catch(exc2){JXG.debug("* Err: Segment "+attr.name+" First: "+input[0].name+", Last: "+input[1].name);return false}break;case"line":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);type="line";if(!input){input=[parseFloat(element.getElementsByTagName("coords")[0].getAttribute("z")),parseFloat(element.getElementsByTagName("coords")[0].getAttribute("x")),parseFloat(element.getElementsByTagName("coords")[0].getAttribute("y"))]}else if(this.board.select(input[1].id).elementClass===JXG.OBJECT_CLASS_LINE){type="parallel"}try{p=this.board.create(type,input,attr);return p}catch(exc3){JXG.debug("* Err: Line "+attr.label);return false}break;case"orthogonalline":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);try{JXG.debug("* Orthogonalline: First: "+input[0].id+", Last: "+input[1].id);p=this.board.create("normal",input,attr);return p}catch(exc4){JXG.debug("* Err: Orthogonalline "+attr.label);return false}break;case"polygon":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);if(input.length===3&&output.length!==4){input[2]=parseInt(input[2],10);type="regular"}try{JXG.debug("* Polygon: First: "+input[0].name+", Second: "+input[1].name+", Third: "+input[2]);borders=[];borderatts=[];length=type==="regular"?output.length-input[2]+2:output.length;for(i=1;i<length;i++){borders[i-1]={};borderatts[i-1]={};borders[i-1].id="";borders[i-1].name=output[i].getAttribute("label");borderatts[i-1]=this.colorProperties(output[i],borderatts[i-1]);borderatts[i-1]=this.visualProperties(output[i],borderatts[i-1])}attr.borders=borders;points=[];if(type==="regular"){points.push(input[0]);points.push(input[1]);for(i=input[2]+1;i<output.length;i++){if(output[i].attributes){points.push(this.checkElement(output[i].getAttribute("label")))}else{points.push(output[i])}}}else{for(i=0;i<input.length;i++){if(typeof input[i]==="object"){points.push(input[i])}}}if(type==="regular"){p=this.board.create("regularpolygon",points,attr)}else{p=this.board.create("polygon",points,attr)}for(i=0;i<p.borders.length;i++){if(borderatts[i].withLabel){p.borders[i].createLabel()}p.borders[i].setAttribute(borderatts[i])}return p}catch(exc5){JXG.debug("* Err: Polygon "+attr.name);return false}break;case"intersect":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);try{JXG.debug("* Intersection: First: "+input[0].name+", Second: "+input[1].name);if(!JXG.exists(attr.styleGGB)){attr.face="circle";attr.fillColor=attr.strokeColor;attr.fillOpacity=1;attr.highlightFillColor=attr.strokeColor;attr.highlightFillOpacity=1;attr.strokeColor="black";attr.strokeWidth=1}if(output.length===1){p=this.board.create("intersection",[input[0],input[1],0],attr)}else{p=this.board.create("intersection",[input[0],input[1],1],attr);attr2={};attr2=this.colorProperties(output[1],attr2);attr2=this.visualProperties(output[1],attr2);attr2.name=output[1].getAttribute("label");p2=this.board.create("otherintersection",[input[0],input[1],p],attr2);this.ggbElements[attr2.name]=p2}return p}catch(exc6){JXG.debug("* Err: Intersection "+attr.name);return false}break;case"distance":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);try{JXG.debug("* Distance: First: "+input[0].name+", Second: "+input[1].name);m=this.board.create("midpoint",input,{visible:"false"});attr.visible="true";p=this.board.create("text",[function(){return m.X()},function(){return m.Y()},function(){return"<span style='text-decoration: overline'>"+input[0].name+input[1].name+"</span> = "+JXG.trimNumber(JXG.toFixed(that.board.select(input[0].id).Dist(that.board.select(input[1].id)),that.decimals))}],attr);p.Value=function(){return that.board.select(input[0].id).Dist(that.board.select(input[1].id))};return p}catch(exc7){JXG.debug("* Err: Distance "+attr.name);return false}break;case"vector":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);if(element.getElementsByTagName("startPoint")[0]){if(input&&input.length===2){e=this.checkElement(input[1].name)}else{e=[parseFloat(element.getElementsByTagName("coords")[0].getAttribute("x")),parseFloat(element.getElementsByTagName("coords")[0].getAttribute("y"))]}if(element.getElementsByTagName("startPoint")[0].getAttribute("x")&&element.getElementsByTagName("startPoint")[0].getAttribute("y")){s=[parseFloat(element.getElementsByTagName("startPoint")[0].getAttribute("x")),parseFloat(element.getElementsByTagName("startPoint")[0].getAttribute("y"))]}else if(element.getElementsByTagName("startPoint")[0].getAttribute("exp")){startpoint=element.getElementsByTagName("startPoint")[0].getAttribute("exp");s=this.checkElement(startpoint)}}else if(input&&input.length!==0){s=input[0];e=input[1]}else{exp=this.getElement(element.getAttribute("label"),true);if(exp){exp=exp.getAttribute("exp");exp=this.ggbParse(exp);if(JXG.isArray(exp)){exp=[new Function("return "+exp[1]+";"),new Function("return "+exp[2]+";")]}else{exp=new Function("return "+exp+";")}JXG.debug("exp: "+exp);p=this.board.create("arrow",[[0,0],[exp[0],exp[1]]],attr);return p}}try{JXG.debug("* Vector: First: "+attr.name);p=this.board.create("arrow",[s,e],attr);return p}catch(exc8){JXG.debug("* Err: Vector "+attr.name+e);return false}break;case"rotate":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);try{JXG.debug("* Rotate: First: "+input[0].name+", Second: "+input[1]);attr.type="rotate";if(!JXG.exists(attr.styleGGB)){attr.face="circle";attr.fillColor=attr.strokeColor;attr.fillOpacity=1;attr.highlightFillColor=attr.strokeColor;attr.highlightFillOpacity=1;attr.strokeColor="black";attr.strokeWidth=1}t=this.board.create("transform",[parseInt(input[1],10)*Math.PI/180,input[2]],{type:"rotate"});p=this.board.create("point",[input[0],t],attr);return p}catch(exc9){JXG.debug("* Err: Rotate "+attr.name);return false}break;case"dilate":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);try{JXG.debug("* Dilate: First: "+input[0].name+", Second: "+input[1]);attr.type="rotate";d=parseInt(input[1],10);d1=this.board.create("transform",[d,d],{type:"scale"});d2=this.board.create("transform",[function(){return(1-d)*input[2].X()},function(){return(1-d)*input[2].Y()}],{type:"translate"});if(!JXG.exists(attr.styleGGB)){attr.face="circle";attr.fillColor=attr.strokeColor;attr.fillOpacity=1;attr.highlightFillColor=attr.strokeColor;attr.highlightFillOpacity=1;attr.strokeColor="black";attr.strokeWidth=1}p=this.board.create("point",[input[0],[d1,d2]],attr);return p}catch(exc10){JXG.debug("* Err: Dilate "+attr.name);return false}break;case"translate":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);try{t=this.board.create("transform",[function(){return input[1].point2.X()-input[1].point1.X()},function(){return input[1].point2.Y()-input[1].point1.Y()}],{type:"translate"});if(!JXG.exists(attr.styleGGB)){attr.face="circle";attr.fillColor=attr.strokeColor;attr.fillOpacity=1;attr.highlightFillColor=attr.strokeColor;attr.highlightFillOpacity=1;attr.strokeColor="black";attr.strokeWidth=1}p=this.board.create("point",[input[0],t],attr);return p}catch(exc11){JXG.debug("* Err: Translate "+attr.name);return false}break;case"mirror":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);if(JXG.isPoint(this.board.select(input[1].id))){type="mirrorpoint"}else if(this.board.select(input[1].id).elementClass===JXG.OBJECT_CLASS_LINE){type="reflection"}try{JXG.debug("* Mirror: First: "+input[0].name+", Second: "+input[1].name);p=this.board.create(type,[input[0],input[1]],attr);return p}catch(exc12){JXG.debug("* Err: Mirror "+attr.name);return false}break;case"circle":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);try{JXG.debug("* Circle: First: "+input[0].name+", Second: "+input[1]);p=this.board.create("circle",input,attr);return p}catch(exc13){JXG.debug("* Err: Circle "+attr.name);return false}break;case"circlearc":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);try{JXG.debug("* CircleArc: First: "+input[0].name+", Second: "+input[1].name+", Third: "+input[2].name);p=this.board.create("arc",input,attr);return p}catch(exc14){JXG.debug("* Err: CircleArc "+attr.name);return false}break;case"ellipse":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);try{JXG.debug("* Ellipse: First: "+input[0].name+", Second: "+input[1].name+", Third: "+input[2]);if(parseInt(input[2],10)===input[2]){input[2]=parseInt(input[2],10)*2}p=this.board.create("ellipse",input,attr);return p}catch(exc15){JXG.debug("* Err: Ellipse "+attr.name);return false}break;case"conic":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);try{if(input&&input.length===5){p=this.board.create("conic",input,attr)}else if(element.getElementsByTagName("matrix")){m=[];for(i=0;i<element.getElementsByTagName("matrix")[0].attributes.length;i++){m[i]=parseFloat(element.getElementsByTagName("matrix")[0].attributes[i].value)}p=this.board.create("conic",m,attr)}return p}catch(exc16){JXG.debug("* Err: Conic "+attr.name);return false}break;case"circlesector":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);try{JXG.debug("* CircleSector: First: "+input[0].name+", Second: "+input[1].name+", Third: "+input[2].name);p=this.board.create("sector",[input[0],input[1],input[2]],attr);return p}catch(exc17){JXG.debug("* Err: CircleSector "+attr.name);return false}break;case"linebisector":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);try{JXG.debug("* LineBiSector (Mittelsenkrechte): First: "+input[0].name);m=this.board.create("midpoint",input,{visible:false});if(JXG.isPoint(this.board.select(input[0].id))&&JXG.isPoint(this.board.select(input[1].id))){t=this.board.create("line",input,{visible:"false"});p=this.board.create("perpendicular",[m,t],attr)}else{p=this.board.create("perpendicular",[m,input[0]],attr)}return p}catch(exc18){JXG.debug("* Err: LineBiSector (Mittelsenkrechte) "+attr.name);return false}break;case"ray":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);try{JXG.debug("* Ray: First: "+input[0].name);attr.straightFirst=true;attr.straightLast=false;p=this.board.create("line",[input[1],input[0]],attr);return p}catch(exc19){JXG.debug("* Err: Ray "+attr.name);return false}break;case"tangent":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);try{JXG.debug("* Tangent: First: "+input[0].name+", Sec.: "+input[1].name+"("+input[1].type+")");switch(input[1].type){case 1330923344:input[0].makeGlider(input[1]);p=this.board.create("tangent",[input[0]],attr);return p;case 1330922316:case 1330922319:pol=this.board.create("polar",[input[1],input[0]],{visible:false});i1=this.board.create("intersection",[input[1],pol,0],{visible:false});i2=this.board.create("intersection",[input[1],pol,1],{visible:false});t1=this.board.create("line",[input[0],i1],attr);attr2={};attr2=this.colorProperties(output[1],attr2);attr2=this.visualProperties(output[1],attr2);attr2.name=output[1].getAttribute("label");t2=this.board.create("line",[input[0],i2],attr2);this.ggbElements[attr2.name]=t2;return[t1,t2]}}catch(exc20){JXG.debug("* Err: Tangent "+attr.name+" "+attr2.name);return false}break;case"circumcirclearc":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);try{JXG.debug("* CircumcircleArc: First: "+input[0].name);p=this.board.create("circumcirclearc",input,attr);return p}catch(exc21){JXG.debug("* Err: CircumcircleArc "+attr.name);return false}break;case"circumcirclesector":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);try{JXG.debug("* CircumcircleSector: First: "+input[0].name);p=this.board.create("circumcirclesector",[input[0],input[1],input[2]],attr);return p}catch(exc22){JXG.debug("* Err: CircumcircleSector "+attr.name);return false}break;case"semicircle":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);try{JXG.debug("* Semicircle: First: "+input[0].name);p=this.board.create("semicircle",[input[0],input[1]],attr);return p}catch(exc23){JXG.debug("* Err: Semicircle "+attr.name);return false}break;case"angle":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);try{JXG.debug("* Angle: First: "+input[0].name);p=this.board.create("angle",input,attr);return p}catch(exc24){JXG.debug("* Err: Angle "+attr.name);return false}break;case"angularbisector":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);attr.straightFirst=true;attr.straightLast=true;try{JXG.debug("* Angularbisector: First: "+input[0].name);p=this.board.create("bisector",input,attr);return p}catch(exc25){JXG.debug("* Err: Angularbisector "+attr.name);return false}break;case"numeric":if(element.getElementsByTagName("slider").length===0){exp=this.getElement(element.getAttribute("label"),true);if(exp){exp=exp.getAttribute("exp");exp=this.functionParse("",exp);exp=this.ggbParse(exp)}this.board.ggb[attr.name]=new Function("return "+exp+";");JXG.debug("value: "+this.board.ggb[attr.name]());return this.board.ggb[attr.name]}attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);attr=this.visualProperties(element,attr);if(element.getElementsByTagName("slider").length===1){sx=parseFloat(element.getElementsByTagName("slider")[0].getAttribute("x"));sy=parseFloat(element.getElementsByTagName("slider")[0].getAttribute("y"));length=parseFloat(element.getElementsByTagName("slider")[0].getAttribute("width"));if(element.getElementsByTagName("slider")[0].getAttribute("absoluteScreenLocation")&&element.getElementsByTagName("slider")[0].getAttribute("absoluteScreenLocation")==="true"){tmp=new JXG.Coords(JXG.COORDS_BY_SCREEN,[sx,sy],this.board);sx=tmp.usrCoords[1];sy=tmp.usrCoords[2]}if(element.getElementsByTagName("slider")[0].getAttribute("horizontal")==="true"){if(element.getElementsByTagName("slider")[0].getAttribute("absoluteScreenLocation")&&element.getElementsByTagName("slider")[0].getAttribute("absoluteScreenLocation")==="true"){length/=this.board.unitX}ex=sx+length;ey=sy}else{if(element.getElementsByTagName("slider")[0].getAttribute("absoluteScreenLocation")&&element.getElementsByTagName("slider")[0].getAttribute("absoluteScreenLocation")==="true"){length/=this.board.unitY}ex=sx;ey=sy+length}if(element.getElementsByTagName("animation")[0]){attr.snapWidth=parseFloat(element.getElementsByTagName("animation")[0].getAttribute("step"))}try{JXG.debug("* Numeric: First: "+attr.name);attr.withTicks=false;p=this.board.create("slider",[[sx,sy],[ex,ey],[parseFloat(element.getElementsByTagName("slider")[0].getAttribute("min")),parseFloat(element.getElementsByTagName("value")[0].getAttribute("val")),parseFloat(element.getElementsByTagName("slider")[0].getAttribute("max"))]],attr);return p}catch(exc26){JXG.debug("* Err: Numeric "+attr.name);return false}}break;case"midpoint":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);try{if(!JXG.exists(attr.styleGGB)){attr.face="circle";attr.fillColor=attr.strokeColor;attr.fillOpacity=1;attr.highlightFillColor=attr.strokeColor;attr.highlightFillOpacity=1;attr.strokeColor="black";attr.strokeWidth=1}p=this.board.create("midpoint",input,attr);JXG.debug("* Midpoint ("+p.id+"): "+attr.name+"("+gxtEl.x+", "+gxtEl.y+")");return p}catch(exc27){JXG.debug("* Err: Midpoint "+attr.name);return false}break;case"center":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);try{if(!JXG.exists(attr.styleGGB)){attr.face="circle";attr.fillColor=attr.strokeColor;attr.fillOpacity=1;attr.highlightFillColor=attr.strokeColor;attr.highlightFillOpacity=1;attr.strokeColor="black";attr.strokeWidth=1}p=this.board.create("point",[function(){return that.board.select(input[0].id).center.X()},function(){return that.board.select(input[0].id).center.Y()}],attr);JXG.debug("* Center ("+p.id+"): "+attr.name+"("+gxtEl.x+", "+gxtEl.y+")");return p}catch(exc28){JXG.debug("* Err: Center "+attr.name);return false}break;case"function":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);if(this.getElement(attr.name,true)){func=this.getElement(attr.name,true).getAttribute("exp");func=this.functionParse("c",func)}else{func=input[0];func=this.functionParse("s",func)}JXG.debug(func);length=func.length;func[func.length-1]="return "+this.ggbParse(func[func.length-1])+";";JXG.debug(func);range=[input&&input[1]?input[1]:null,input&&input[2]?input[2]:null];rx=/([x|y])\((\w+)\)/;for(i=0;i<2;i++){match=rx.exec(range[i]);if(match){range[i]=match[1].toUpperCase()+"("+match[2]+")"}}try{if(length===1){p=this.board.create("functiongraph",[new Function(func[0]),range[0],range[1]],attr)}else if(length===2){p=this.board.create("functiongraph",[new Function(func[0],func[1]),range[0],range[1]],attr)}else if(length===3){p=this.board.create("functiongraph",[new Function(func[0],func[1],func[2]),range[0],range[1]],attr)}else if(length===4){p=this.board.create("functiongraph",[new Function(func[0],func[1],func[2],func[3]),range[0],range[1]],attr)}else if(length===5){p=this.board.create("functiongraph",[new Function(func[0],func[1],func[2],func[3],func[4]),range[0],range[1]],attr)}return p}catch(exc29){JXG.debug("* Err: Functiongraph "+attr.name);return false}break;case"polar":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);try{JXG.debug("* Polar: First: "+input[0].name+", Sec.: "+input[1].name);p=this.board.create("polar",input,attr);return p}catch(exc30){JXG.debug("* Err: Polar "+attr.name);return false}break;case"slope":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);try{JXG.debug("* Slope ("+attr.name+"): First: "+input[0].name);slopeWidth=parseInt(attr.slopeWidth,10)||1;p1=input[0].glider||input[0].point1;p2=this.board.create("point",[function(){return slopeWidth+p1.X()},function(){return p1.Y()}],{visible:false});l1=this.board.create("segment",[p1,p2],{visible:false});l2=this.board.create("normal",[l1,l1.point2],{visible:false});i=this.board.create("intersection",[input[0],l2,0],{visible:false});m=this.board.create("midpoint",[l1.point2,i],{visible:false});t=this.board.create("text",[function(){return m.X()},function(){return m.Y()},function(){return" "+(slopeWidth>1?slopeWidth.toString():"")+" "+this.name+" = "+JXG.trimNumber(JXG.toFixed(slopeWidth*input[0].getSlope(),that.decimals))}],attr);attr.name="";t2=this.board.create("text",[function(){return(p1.X()+p2.X())/2},function(){return p1.Y()},function(){return"<br/>"+slopeWidth}],attr);t.Value=function(){return function(){return input[0].getSlope()}}();poly=this.board.create("polygon",[p1,p2,i],attr);poly.borders[2].setAttribute({visible:false});poly.borders[0].setAttribute({strokeColor:attr.fillColor,strokeWidth:attr.strokeWidth,highlightStrokeColor:attr.fillColor,dash:attr.dash});poly.borders[1].setAttribute({strokeColor:attr.fillColor,strokeWidth:attr.strokeWidth,highlightStrokeColor:attr.fillColor,dash:attr.dash});return t}catch(exc31){JXG.debug("* Err: Slope "+attr.name);return false}break;case"text":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);res="";try{if(element.getElementsByTagName("isLaTeX")[0]&&element.getElementsByTagName("isLaTeX")[0].getAttribute("val")==="true"){this.board.options.text.useASCIIMathML=true;t=this.getElement(attr.name,true).getAttribute("exp");rx=t.match(/(.*?)" \+ (.+) \+ "(.*)/);while(rx){re2=this.ggbParse(RegExp.$2);if(typeof re2==="string"){res=res+RegExp.$1+re2}else{res=res+RegExp.$1+'" + JXG.trimNumber(JXG.toFixed('+re2+", "+this.decimals+')) + "'}t=RegExp.$3;rx=t.match(/(.*?)" \+ (.+) \+ "(.*)/)}rx=t.match(/(.*?)" \+ (.+)/);if(rx){res=res+RegExp.$1+'" + JXG.trimNumber(JXG.toFixed('+this.ggbParse(RegExp.$2)+", "+this.decimals+"))"}else{res=res+t}JXG.debug("Text: "+res);p=this.board.create("text",[gxtEl.x,gxtEl.y,new Function("return "+res+";")],attr)}else{JXG.debug(this.getElement(attr.name,true).getAttribute("exp"));t=this.functionParse(false,this.getElement(attr.name,true).getAttribute("exp"));t=this.ggbParse(t);JXG.debug(t[1]);if(JXG.isArray(t)){p=this.board.create("text",[gxtEl.x,gxtEl.y,new Function("return "+t[0]+' + " " + JXG.trimNumber(JXG.toFixed(parseFloat('+t[1]+", "+this.decimals+"));")],attr)}else{p=this.board.create("text",[gxtEl.x,gxtEl.y,t],attr)}}JXG.debug("* Text: "+t);return p}catch(exc32){JXG.debug("* Err: Text: "+t,exc32,exc32.stack);return false}break;case"root":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);for(i=0;i<output.length;i++){output[i]=this.checkElement(output[i].getAttribute("label"))}if(JXG.isArray(input)){inp=input[0]}else{inp=input}for(i=0;i<output.length;i++){output[i].addConstraint([makeRootFun(output[i].X()),makeConstFun(0)])}return output;case"integral":attr=this.boardProperties(gxtEl,element,attr);attr=this.colorProperties(element,attr);gxtEl=this.coordinates(gxtEl,element);attr=this.visualProperties(element,attr);try{JXG.debug("* Integral: First: "+input[0].name+", Sec.: "+input[1].name+", Thir.: "+input[2].name);JXG.debug([input[1](),input[2]()]);p=this.board.create("integral",[this.board.select(input[0]),[input[1],input[2]]],attr);return p}catch(exc33){JXG.debug("* Err: Integral "+attr.name+e);return false}break;default:return false}},read:function(){var type,constructions,el,Data,i,t,s,expr,cmds,input,output,elname,elements;this.writeBoard();this.setDefaultOptions();constructions=this.tree.getElementsByTagName("construction");for(t=0;t<constructions.length;t++){cmds=constructions[t].getElementsByTagName("command");for(s=0;s<cmds.length;s++){Data=cmds[s];JXG.debug("now i'll parse the command:");JXG.debug(Data);input=[];for(i=0;i<Data.getElementsByTagName("input")[0].attributes.length;i++){el=Data.getElementsByTagName("input")[0].attributes[i].value;if(el.match(/\u00B0/)||!el.match(/\D/)||el.match(/Circle/)||Data.getAttribute("name")==="Function"||el===parseFloat(el)){input[i]=el}else if(el==="xAxis"||el==="yAxis"){input[i]=this.ggbElements[el]}else{input[i]=this.checkElement(el)}}output=[];elname=Data.getElementsByTagName("output")[0].attributes[0].value;for(i=0;i<Data.getElementsByTagName("output")[0].attributes.length;i++){el=Data.getElementsByTagName("output")[0].attributes[i].value;output[i]=this.getElement(el)}if(!JXG.exists(this.ggbElements[elname])||this.ggbElements[elname]===""){this.ggbElements[elname]=this.writeElement(output,input,Data.getAttribute("name").toLowerCase());if(this.ggbElements[elname].borders){for(i=0;i<this.ggbElements[elname].borders.length;i++){this.ggbElements[this.ggbElements[elname].borders[i].name]=this.ggbElements[elname].borders[i]}}}}JXG.debug("Restesammler: ");elements=constructions[t].getElementsByTagName("element");for(s=0;s<elements.length;s++){Data=elements[s];el=Data.getAttribute("label");if(!JXG.exists(this.ggbElements[el])||this.ggbElements===""){this.ggbElements[el]=this.writeElement(Data);expr=this.getElement(el,true);if(expr){type=Data.getAttribute("type");switch(type){case"text":case"function":break;default:this.ggbParse(expr.getAttribute("exp"),el);break}}}}}this.board.unsuspendUpdate();this.board.fullUpdate()},utf8replace:function(exp){exp=exp.replace(/\u03C0/g,"PI").replace(/\u00B2/g,"^2").replace(/\u00B3/g,"^3").replace(/\u225F/g,"==").replace(/\u2260/g,"!=").replace(/\u2264/g,"<=").replace(/\u2265/g,">=").replace(/\u2227/g,"&&").replace(/\u2228/g,"//");return exp},prepareString:function(fileStr){var i,bA,len,fstr,isString=fileStr.slice(0,2)!=="PK";if(isString&&fileStr.indexOf("<")!==0){fstr=JXG.Util.Base64.decode(fileStr);if(fstr.slice(0,2)!=="PK"){fstr=JXG.Util.Base64.decode(fileStr,true)}fileStr=fstr}if(fileStr.indexOf("<")!==0){bA=[];len=fileStr.length;for(i=0;i<len;i++){bA[i]=JXG.Util.UTF8.asciiCharCodeAt(fileStr,i)}fileStr=new JXG.Util.Unzip(bA).unzipFile("geogebra.xml")}fileStr=JXG.Util.UTF8.decode(fileStr);fileStr=this.utf8replace(fileStr);return fileStr},isGGBVector:function(v){return JXG.isArray(v)&&v.length===3&&v[0]===1}});JXG.registerReader(JXG.GeogebraReader,["ggb","geogebra"])})();
|
|
61
|
+
!function(){"use strict";JXG.GeogebraReader=function(e,t){var r,s;s=this.prepareString(t),r=JXG.XML.parse(s),this.tree=r,this.board=e,this.ggbElements=[],this.board.ggb={},this.format=parseFloat(r.getElementsByTagName("geogebra")[0].getAttribute("format")),this.decimals=parseInt(r.getElementsByTagName("geogebra")[0].getElementsByTagName("kernel")[0].getElementsByTagName("decimals")[0].getAttribute("val"),10)},JXG.extend(JXG.GeogebraReader.prototype,{ggbAct:function(e,t,r){var s,a,i,o=new RegExp("JXG\\.boards\\['"+this.board.id+'\'\\].select\\("(.+?)"\\)\\.'),n=new RegExp("JXG\\.boards\\['"+this.board.id+"'\\].select"),c=t,l=r;switch(e.toLowerCase()){case"end":case"param":case"html":return c;case"coord":return[s=this.ggbElements[c]?"JXG.boards['"+this.board.id+"'].select('"+c+"')":c,a=this.ggbElements[l]?"JXG.boards['"+this.board.id+"'].select('"+l+"')":l];case"le":return"( ("+c+") <= ("+l+") )";case"ge":return"( ("+c+") >= ("+l+") )";case"eq":return"( ("+c+") == ("+l+") )";case"neq":return"( ("+c+") != ("+l+") )";case"lt":return"( ("+c+") < ("+l+") )";case"gt":return"( ("+c+") > ("+l+") )";case"add":return this.isGGBVector(c)&&this.isGGBVector(l)?[1,c[1]+"+"+l[1],c[2]+"+"+l[2]]:(s=JXG.isString(c)&&!c.match(o)&&c.match(n)?[c+".X()",c+".Y()"]:c,a=JXG.isString(l)&&!l.match(o)&&l.match(n)?[l+".X()",l+".Y()"]:l,this.isGGBVector(s)&&JXG.isArray(a)?[s[1]+"+"+a[0],s[2]+"+"+a[1]]:this.isGGBVector(a)&&JXG.isArray(s)?[a[1]+"+"+s[0],a[2]+"+"+s[1]]:JXG.isArray(s)&&JXG.isArray(a)?[s[0]+" + "+a[0],s[1]+" + "+a[1]]:(JXG.isNumber(s)||JXG.isString(s))&&(JXG.isNumber(a)||JXG.isString(a))?s+" + "+a:(JXG.isNumber(s)||JXG.isString(s))&&JXG.isArray(a)?[s+" + "+a[0],s+" + "+a[1]]:JXG.isArray(s)&&(JXG.isNumber(a)||JXG.isString(a))?[s[0]+" + "+a,s[1]+" + "+a]:s+" + "+a);case"sub":return this.isGGBVector(c)&&this.isGGBVector(l)?[1,c[1]+"-"+l[1],c[2]+"-"+l[2]]:(s=JXG.isString(c)&&!c.match(o)&&c.match(n)?[c+".X()",c+".Y()"]:c,a=JXG.isString(l)&&!l.match(o)&&l.match(n)?[l+".X()",l+".Y()"]:l,this.isGGBVector(s)&&JXG.isArray(a)?[s[1]+"-"+a[0],s[2]+"-"+a[1]]:JXG.isArray(s)&&this.isGGBVector(a)?[s[0]+"-("+a[1]+")",s[1]+"-("+a[2]+")"]:JXG.isArray(s)&&JXG.isArray(a)?[s[0]+" - "+a[0],s[1]+" - "+a[1]]:(JXG.isNumber(s)||JXG.isString(s))&&(JXG.isNumber(a)||JXG.isString(a))?s+" - "+a:(JXG.isNumber(s)||JXG.isString(s))&&JXG.isArray(a)?[s+" - "+a[0],s+" - "+a[1]]:JXG.isArray(s)&&(JXG.isNumber(a)||JXG.isString(a))?[s[0]+" - "+a,s[1]+" - "+a]:s+" - "+a);case"neg":return"!("+c+")";case"pow":return"Math.pow("+c+", "+l+")";case"or":return"("+c+"||"+l+")";case"and":return"("+c+"&&"+l+")";case"mul":return this.isGGBVector(c)&&!JXG.isArray(l)?[1,"("+c[1]+")*"+l,"("+c[2]+")*"+l]:!JXG.isArray(c)&&this.isGGBVector(l)?[1,"("+l[1]+")*"+c,"("+l[2]+")*"+c]:this.isGGBVector(c)&&this.isGGBVector(l)?"(("+c[1]+")*("+l[1]+")+("+c[2]+")*("+l[2]+"))":(s=JXG.isString(c)&&!c.match(o)&&c.match(n)?[c+".X()",c+".Y()"]:c,a=JXG.isString(l)&&!l.match(o)&&l.match(n)?[l+".X()",l+".Y()"]:l,JXG.isArray(s)&&JXG.isArray(a)?[s[0]+" * "+a[0],s[1]+" * "+a[1]]:(JXG.isNumber(s)||JXG.isString(s))&&(JXG.isNumber(a)||JXG.isString(a))?s+" * "+a:(JXG.isNumber(s)||JXG.isString(s))&&JXG.isArray(a)?[s+" * "+a[0],s+" * "+a[1]]:JXG.isArray(s)&&(JXG.isNumber(a)||JXG.isString(a))?[s[0]+" * "+a,s[1]+" * "+a]:s+" * "+a);case"div":return s=JXG.isString(c)&&!c.match(o)&&c.match(n)?[c+".X()",c+".Y()"]:c,a=JXG.isString(l)&&!l.match(o)&&l.match(n)?[l+".X()",l+".Y()"]:l,JXG.isArray(s)&&JXG.isArray(a)?[s[0]+" / "+a[0],s[1]+" / "+a[1]]:(JXG.isNumber(s)||JXG.isString(s))&&(JXG.isNumber(a)||JXG.isString(a))?s+" / "+a:(JXG.isNumber(s)||JXG.isString(s))&&JXG.isArray(a)?[s+" / "+a[0],s+" / "+a[1]]:JXG.isArray(s)&&(JXG.isNumber(a)||JXG.isString(a))?[s[0]+" / "+a,s[1]+" / "+a]:s+" / "+a;case"negmult":return this.isGGBVector(c)?[1,"-1*"+c[1],"-1*"+c[2]]:"-1*"+c;case"bra":return this.isGGBVector(c)?[1,"("+c[1]+")","("+c[2]+")"]:"("+c+")";case"int":return parseInt(c,10);case"float":return parseFloat(c);case"string":return l?[c,l]:c;case"command":if(s=(l=c.split("["))[0],a=l[1].split("]")[0],"name"===s.toLowerCase())return"JXG.boards['"+this.board.id+"'].select('"+a+"').getName()";break;case"var":if(!l)return"PI"===c?"Math.PI":(i=this.checkElement(c),JXG.exists(this.board.ggb[c])?"JXG.boards['"+this.board.id+"'].ggb[\""+c+'"]()':JXG.exists(i.Value)?"JXG.boards['"+this.board.id+"'].select(\""+c+'").Value()':JXG.exists(i.Area)?"JXG.boards['"+this.board.id+"'].select(\""+c+'").Area()':JXG.exists(i.plaintextStr)?"1.0*JXG.boards['"+this.board.id+"'].select(\""+c+'").plaintextStr':i.type===JXG.OBJECT_TYPE_VECTOR?[1,"JXG.boards['"+this.board.id+"'].select(\""+c+"\").point2.X()-JXG.boards['"+this.board.id+"'].select(\""+c+'").point1.X()',"JXG.boards['"+this.board.id+"'].select(\""+c+"\").point2.Y()-JXG.boards['"+this.board.id+"'].select(\""+c+'").point1.Y()']:i.elementClass===JXG.OBJECT_CLASS_LINE?"JXG.boards['"+this.board.id+"'].select(\""+c+"\").point1.Dist(JXG.boards['"+this.board.id+"'].select(\""+c+'").point2)':"JXG.boards['"+this.board.id+"'].select(\""+c+'")');switch(c.toLowerCase()){case"x":return l+".X()";case"y":return l+".Y()";case"abs":case"acos":case"asin":case"atan":case"ceil":case"cos":case"exp":case"floor":case"log":case"max":case"min":case"pow":case"random":case"round":case"sin":case"sqrt":case"tan":return"Math."+c.toLowerCase()+"("+l+")";default:return c.toLowerCase()+"*("+l+")"}}},ggbParse:function(e,t){var r,s,a=[],i=[],o="",n=e,c=!1,l=this,h=!!t&&this.board.select(this.ggbElements[t].id);function g(e){var t=0,r=-1,s=0,a=0,i=e.offset+1;do{if(t=0,r=-2,a=i-=1,e.src.length<=a)return 28;do{switch(t){case 0:t=9===e.src.charCodeAt(i)||32===e.src.charCodeAt(i)?1:33===e.src.charCodeAt(i)?2:40===e.src.charCodeAt(i)?3:41===e.src.charCodeAt(i)?4:42===e.src.charCodeAt(i)?5:43===e.src.charCodeAt(i)?6:44===e.src.charCodeAt(i)?7:45===e.src.charCodeAt(i)?8:47===e.src.charCodeAt(i)?9:e.src.charCodeAt(i)>=48&&e.src.charCodeAt(i)<=57?10:60===e.src.charCodeAt(i)?11:62===e.src.charCodeAt(i)?12:e.src.charCodeAt(i)>=65&&e.src.charCodeAt(i)<=90||e.src.charCodeAt(i)>=97&&e.src.charCodeAt(i)<=122?13:94===e.src.charCodeAt(i)?14:34===e.src.charCodeAt(i)?26:38===e.src.charCodeAt(i)?28:46===e.src.charCodeAt(i)?29:61===e.src.charCodeAt(i)?30:95===e.src.charCodeAt(i)?31:124===e.src.charCodeAt(i)?32:-1;break;case 1:t=-1,r=1,s=i;break;case 2:t=61===e.src.charCodeAt(i)?15:-1,r=23,s=i;break;case 3:t=-1,r=2,s=i;break;case 4:t=-1,r=3,s=i;break;case 5:t=-1,r=13,s=i;break;case 6:t=-1,r=11,s=i;break;case 7:t=-1,r=16,s=i;break;case 8:t=-1,r=12,s=i;break;case 9:t=-1,r=14,s=i;break;case 10:t=e.src.charCodeAt(i)>=48&&e.src.charCodeAt(i)<=57?10:46===e.src.charCodeAt(i)?18:-1,r=4,s=i;break;case 11:t=61===e.src.charCodeAt(i)?19:-1,r=21,s=i;break;case 12:t=61===e.src.charCodeAt(i)?21:-1,r=22,s=i;break;case 13:t=e.src.charCodeAt(i)>=65&&e.src.charCodeAt(i)<=90||e.src.charCodeAt(i)>=97&&e.src.charCodeAt(i)<=122?13:e.src.charCodeAt(i)>=48&&e.src.charCodeAt(i)<=57?27:91===e.src.charCodeAt(i)?34:95===e.src.charCodeAt(i)?35:-1,r=7,s=i;break;case 14:t=-1,r=15,s=i;break;case 15:t=-1,r=20,s=i;break;case 16:t=-1,r=9,s=i;break;case 17:t=-1,r=25,s=i;break;case 18:t=e.src.charCodeAt(i)>=48&&e.src.charCodeAt(i)<=57?18:-1,r=5,s=i;break;case 19:t=-1,r=17,s=i;break;case 20:t=-1,r=19,s=i;break;case 21:t=-1,r=18,s=i;break;case 22:t=-1,r=24,s=i;break;case 23:t=-1,r=8,s=i;break;case 24:t=e.src.charCodeAt(i)>=48&&e.src.charCodeAt(i)<=57||e.src.charCodeAt(i)>=65&&e.src.charCodeAt(i)<=90||e.src.charCodeAt(i)>=97&&e.src.charCodeAt(i)<=122?24:-1,r=6,s=i;break;case 25:t=-1,r=10,s=i;break;case 26:t=34===e.src.charCodeAt(i)?16:32===e.src.charCodeAt(i)||46===e.src.charCodeAt(i)||e.src.charCodeAt(i)>=48&&e.src.charCodeAt(i)<=57||61===e.src.charCodeAt(i)||e.src.charCodeAt(i)>=65&&e.src.charCodeAt(i)<=90||e.src.charCodeAt(i)>=97&&e.src.charCodeAt(i)<=122||223===e.src.charCodeAt(i)||228===e.src.charCodeAt(i)||246===e.src.charCodeAt(i)||252===e.src.charCodeAt(i)?26:-1;break;case 27:t=e.src.charCodeAt(i)>=48&&e.src.charCodeAt(i)<=57||e.src.charCodeAt(i)>=65&&e.src.charCodeAt(i)<=90||e.src.charCodeAt(i)>=97&&e.src.charCodeAt(i)<=122?27:95===e.src.charCodeAt(i)?35:-1,r=7,s=i;break;case 28:t=38===e.src.charCodeAt(i)?17:e.src.charCodeAt(i)>=65&&e.src.charCodeAt(i)<=90||e.src.charCodeAt(i)>=97&&e.src.charCodeAt(i)<=122?33:-1;break;case 29:t=e.src.charCodeAt(i)>=48&&e.src.charCodeAt(i)<=57?18:-1;break;case 30:t=61===e.src.charCodeAt(i)?20:-1;break;case 31:t=95===e.src.charCodeAt(i)?36:-1;break;case 32:t=124===e.src.charCodeAt(i)?22:-1;break;case 33:t=59===e.src.charCodeAt(i)?23:e.src.charCodeAt(i)>=65&&e.src.charCodeAt(i)<=90||e.src.charCodeAt(i)>=97&&e.src.charCodeAt(i)<=122?33:-1;break;case 34:t=e.src.charCodeAt(i)>=65&&e.src.charCodeAt(i)<=90||e.src.charCodeAt(i)>=97&&e.src.charCodeAt(i)<=122?37:-1;break;case 35:t=e.src.charCodeAt(i)>=48&&e.src.charCodeAt(i)<=57||e.src.charCodeAt(i)>=65&&e.src.charCodeAt(i)<=90||e.src.charCodeAt(i)>=97&&e.src.charCodeAt(i)<=122?27:95===e.src.charCodeAt(i)?35:-1;break;case 36:t=e.src.charCodeAt(i)>=48&&e.src.charCodeAt(i)<=57||e.src.charCodeAt(i)>=65&&e.src.charCodeAt(i)<=90||e.src.charCodeAt(i)>=97&&e.src.charCodeAt(i)<=122?24:-1;break;case 37:t=93===e.src.charCodeAt(i)?25:e.src.charCodeAt(i)>=65&&e.src.charCodeAt(i)<=90||e.src.charCodeAt(i)>=97&&e.src.charCodeAt(i)<=122?37:-1}i+=1}while(t>-1)}while(1===r);return r>-1?(e.att=e.src.substr(a,s-a),e.offset=s):(e.att="",r=-1),r}if(h&&JXG.debug("Update element: "+h.name+"("+h.id+")"),(s=function(e,t,r){var s,a,i,o,b,d,u,m,p,G,A,y=[],C=[],X=0,f={};for(p=[[0,1],[27,1],[26,5],[26,3],[26,3],[26,3],[26,3],[26,3],[26,3],[26,3],[26,3],[26,2],[26,3],[26,3],[26,3],[26,3],[26,3],[26,2],[26,3],[26,3],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,4],[26,1]],m=[[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[28,0],[14,13,13,14,25,15,24,16,15,17,12,18,11,19,22,20,21,21,20,22,19,23,18,24,17,25,28,-1],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[11,29,28,-24,17,-24,18,-24,19,-24,20,-24,21,-24,22,-24,12,-24,15,-24,24,-24,25,-24,13,-24,14,-24,16,-24,3,-24],[28,-20,17,-20,18,-20,19,-20,20,-20,21,-20,22,-20,11,-20,12,-20,15,-20,24,-20,25,-20,13,-20,14,-20,16,-20,3,-20],[28,-21,17,-21,18,-21,19,-21,20,-21,21,-21,22,-21,11,-21,12,-21,15,-21,24,-21,25,-21,13,-21,14,-21,16,-21,3,-21],[28,-22,17,-22,18,-22,19,-22,20,-22,21,-22,22,-22,11,-22,12,-22,15,-22,24,-22,25,-22,13,-22,14,-22,16,-22,3,-22],[28,-23,17,-23,18,-23,19,-23,20,-23,21,-23,22,-23,11,-23,12,-23,15,-23,24,-23,25,-23,13,-23,14,-23,16,-23,3,-23],[28,-25,17,-25,18,-25,19,-25,20,-25,21,-25,22,-25,11,-25,12,-25,15,-25,24,-25,25,-25,13,-25,14,-25,16,-25,3,-25],[2,30,28,-27,17,-27,18,-27,19,-27,20,-27,21,-27,22,-27,11,-27,12,-27,15,-27,24,-27,25,-27,13,-27,14,-27,16,-27,3,-27],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[14,13,13,14,25,15,24,16,15,17,12,18,11,19,22,20,21,21,20,22,19,23,18,24,17,25,16,44,3,45],[14,-11,13,-11,25,15,24,16,15,-11,12,-11,11,-11,22,-11,21,-11,20,-11,19,-11,18,-11,17,-11,28,-11,16,-11,3,-11],[14,-17,13,-17,25,15,24,16,15,17,12,-17,11,-17,22,20,21,21,20,22,19,23,18,24,17,25,28,-17,16,-17,3,-17],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[14,-16,13,-16,25,15,24,16,15,17,12,-16,11,-16,22,20,21,21,20,22,19,23,18,24,17,25,28,-16,16,-16,3,-16],[14,-15,13,-15,25,15,24,16,15,17,12,-15,11,-15,22,20,21,21,20,22,19,23,18,24,17,25,28,-15,16,-15,3,-15],[14,-14,13,-14,25,-14,24,-14,15,-14,12,-14,11,-14,22,-14,21,-14,20,-14,19,-14,18,-14,17,-14,28,-14,16,-14,3,-14],[14,-13,13,-13,25,-13,24,-13,15,-13,12,-13,11,-13,22,-13,21,-13,20,-13,19,-13,18,-13,17,-13,28,-13,16,-13,3,-13],[14,-12,13,-12,25,15,24,16,15,-12,12,-12,11,-12,22,20,21,21,20,22,19,23,18,24,17,25,28,-12,16,-12,3,-12],[14,13,13,14,25,15,24,16,15,17,12,-10,11,-10,22,20,21,21,20,22,19,23,18,24,17,25,28,-10,16,-10,3,-10],[14,13,13,14,25,15,24,16,15,17,12,-9,11,-9,22,20,21,21,20,22,19,23,18,24,17,25,28,-9,16,-9,3,-9],[14,-8,13,-8,25,15,24,16,15,-8,12,-8,11,-8,22,-8,21,-8,20,-8,19,-8,18,-8,17,-8,28,-8,16,-8,3,-8],[14,-7,13,-7,25,15,24,16,15,-7,12,-7,11,-7,22,-7,21,-7,20,-7,19,-7,18,-7,17,-7,28,-7,16,-7,3,-7],[14,-6,13,-6,25,15,24,16,15,-6,12,-6,11,-6,22,-6,21,-6,20,-6,19,-6,18,-6,17,-6,28,-6,16,-6,3,-6],[14,-5,13,-5,25,15,24,16,15,-5,12,-5,11,-5,22,-5,21,-5,20,-5,19,-5,18,-5,17,-5,28,-5,16,-5,3,-5],[14,-4,13,-4,25,15,24,16,15,-4,12,-4,11,-4,22,-4,21,-4,20,-4,19,-4,18,-4,17,-4,28,-4,16,-4,3,-4],[14,-3,13,-3,25,15,24,16,15,-3,12,-3,11,-3,22,-3,21,-3,20,-3,19,-3,18,-3,17,-3,28,-3,16,-3,3,-3],[2,3,23,4,12,5,9,6,4,7,5,8,6,9,8,10,10,11,7,12],[28,-18,17,-18,18,-18,19,-18,20,-18,21,-18,22,-18,11,-18,12,-18,15,-18,24,-18,25,-18,13,-18,14,-18,16,-18,3,-18],[14,13,13,14,25,15,24,16,15,17,12,-19,11,-19,22,20,21,21,20,22,19,23,18,24,17,25,28,-19,16,-19,3,-19],[14,13,13,14,25,15,24,16,15,17,12,18,11,19,22,20,21,21,20,22,19,23,18,24,17,25,3,49],[14,13,13,14,25,15,24,16,15,17,12,18,11,19,22,20,21,21,20,22,19,23,18,24,17,25,3,50],[28,-26,17,-26,18,-26,19,-26,20,-26,21,-26,22,-26,11,-26,12,-26,15,-26,24,-26,25,-26,13,-26,14,-26,16,-26,3,-26],[28,-2,17,-2,18,-2,19,-2,20,-2,21,-2,22,-2,11,-2,12,-2,15,-2,24,-2,25,-2,13,-2,14,-2,16,-2,3,-2]],G=[[27,1,26,2],[],[],[26,26],[26,27],[26,28],[],[],[],[],[],[],[],[26,31],[26,32],[26,33],[26,34],[26,35],[26,36],[26,37],[26,38],[26,39],[26,40],[26,41],[26,42],[26,43],[],[],[],[26,46],[26,47],[],[],[],[],[],[],[],[],[],[],[],[],[],[26,48],[],[],[],[],[],[]],A=["p'","WHITESPACE","(",")","INT","FLOAT","PARAM","VAR","HTML","STRING","COMMAND","+","-","*","/","^",",","<=",">=","==","!=","<",">","!","||","&&","e","p","$$"],f.offset=0,f.src=e,f.att="",t||(t=[]),r||(r=[]),y.push(0),C.push(0),o=g(f);;){for(a=52,s=0;s<m[y[y.length-1]].length;s+=2)if(m[y[y.length-1]][s]===o){a=m[y[y.length-1]][s+1];break}if(52===a){for(X+=1,t.push(f.offset-f.att.length),r.push([]),s=0;s<m[y[y.length-1]].length;s+=2)r[r.length-1].push(A[m[y[y.length-1]][s]]);for(u=[],d=[],s=0;s<y.length;s++)u[s]=y[s],d[s]=C[s];for(;52===a&&28!==o;){for(c,-1===o&&(f.offset+=1);52===a&&y.length>0&&(y.pop(),C.pop(),0!==y.length);)for(a=52,s=0;s<m[y[y.length-1]].length;s+=2)if(m[y[y.length-1]][s]===o){a=m[y[y.length-1]][s+1];break}if(52!==a)break;for(s=0;s<u.length;s++)y.push(u[s]),C.push(d[s]);o=g(f)}if(52===a){c;break}c}if(a>0)y.push(a),C.push(f.att),o=g(f);else{switch(b=undefined,a*=-1){case 0:b=C[C.length-1];break;case 1:b=l.ggbAct("end",C[C.length-1]);break;case 2:b=l.ggbAct("coord",C[C.length-4],C[C.length-2],h);break;case 3:b=l.ggbAct("le",C[C.length-3],C[C.length-1]);break;case 4:b=l.ggbAct("ge",C[C.length-3],C[C.length-1]);break;case 5:b=l.ggbAct("eq",C[C.length-3],C[C.length-1]);break;case 6:b=l.ggbAct("neq",C[C.length-3],C[C.length-1]);break;case 7:b=l.ggbAct("lt",C[C.length-3],C[C.length-1]);break;case 8:b=l.ggbAct("gt",C[C.length-3],C[C.length-1]);break;case 9:b=l.ggbAct("add",C[C.length-3],C[C.length-1]);break;case 10:b=l.ggbAct("sub",C[C.length-3],C[C.length-1]);break;case 11:b=l.ggbAct("neg",C[C.length-1]);break;case 12:b=l.ggbAct("pow",C[C.length-3],C[C.length-1]);break;case 13:b=l.ggbAct("or",C[C.length-3],C[C.length-1]);break;case 14:b=l.ggbAct("and",C[C.length-3],C[C.length-1]);break;case 15:b=l.ggbAct("mul",C[C.length-3],C[C.length-1]);break;case 16:b=l.ggbAct("div",C[C.length-3],C[C.length-1]);break;case 17:b=l.ggbAct("negmult",C[C.length-1]);break;case 18:b=l.ggbAct("bra",C[C.length-2]);break;case 19:b=l.ggbAct("string",C[C.length-3],C[C.length-1]);break;case 20:b=l.ggbAct("int",C[C.length-1]);break;case 21:b=l.ggbAct("float",C[C.length-1]);break;case 22:b=l.ggbAct("param",C[C.length-1]);break;case 23:b=l.ggbAct("html",C[C.length-1]);break;case 24:b=l.ggbAct("string",C[C.length-1]);break;case 25:b=l.ggbAct("command",C[C.length-1]);break;case 26:b=l.ggbAct("var",C[C.length-4],C[C.length-2]);break;case 27:b=l.ggbAct("var",C[C.length-1])}for(s=0;s<p[a][1];s++)y.pop(),n=C.pop();for(i=-1,s=0;s<G[y[y.length-1]].length;s+=2)if(G[y[y.length-1]][s]===p[a][0]){i=G[y[y.length-1]][s+1];break}if(0===a)break;c,y.push(i),C.push(b)}c}return X}(n,a,i))>0){for(r=0;r<s;r++)o+="Parse error in line "+(n.substr(0,a[r]).match(/\n/g)?n.substr(0,a[r]).match(/\n/g).length:1)+" near '"+n.substr(a[r])+"', expecting '"+i[r].join()+"'\n";JXG.debug(o)}return n},setDefaultOptions:function(){this.board.options.elements.strokeWidth=1,this.board.options.elements.withLabel=!0,this.board.options.point.face="circle",this.board.options.point.size=3,this.board.options.point.fillColor="blue",this.board.options.point.fillOpacity=1,this.board.options.point.highlightFillOpacity=1,this.board.options.point.strokeColor="black",this.board.options.point.highlightStrokeColor="black",this.board.options.point.strokeWidth=2,this.board.options.line.strokeWidth=1,this.board.options.line.highlightStrokeColor="#000000",this.board.options.line.strokeColor="#000000",this.board.options.polygon.fillColor=JXG.rgb2hex(153,51,0),this.board.options.polygon.fillOpacity=.1,this.board.options.polygon.highlightFillColor=this.board.options.polygon.fillColor,this.board.options.polygon.highlightFillOpacity=.1,this.board.options.sector.fillColor=JXG.rgb2hex(153,51,0),this.board.options.sector.fillOpacity=.1,this.board.options.sector.highlightFillColor=this.board.options.sector.fillColor,this.board.options.sector.highlightFillOpacity=.1,this.board.options.angle.fillColor=JXG.rgb2hex(0,100,0),this.board.options.angle.fillOpacity=.1,this.board.options.angle.highlightFillOpacity=.1},colorProperties:function(e,t){var r,s,a,i,o=e.getElementsByTagName("objColor")[0],n=e.getElementsByTagName("objColor").length>0;return r=n&&o.getAttribute("alpha")?parseFloat(o.getAttribute("alpha")):0,s=n&&o.getAttribute("r")?parseInt(o.getAttribute("r"),10).toString(16):0,a=n&&o.getAttribute("g")?parseInt(o.getAttribute("g"),10).toString(16):0,i=n&&o.getAttribute("b")?parseInt(o.getAttribute("b"),10).toString(16):0,1===s.length&&(s="0"+s),1===a.length&&(a="0"+a),1===i.length&&(i="0"+i),t.fillColor="#"+s+a+i,t.strokeColor=t.fillColor,t.highlightFillColor=t.fillColor,t.highlightStrokeColor=t.strokeColor,t.fillOpacity=r,t.highlightFillOpacity=r,t.labelColor=t.fillColor,t},boardProperties:function(e,t,r){return r},coordinates:function(e,t){var r,s,a={x:0,y:0,z:0};if(t.getElementsByTagName("labelOffset")[0]&&(a.x=parseFloat(t.getElementsByTagName("labelOffset")[0].getAttribute("x"))/this.board.unitX,a.y=parseFloat(t.getElementsByTagName("labelOffset")[0].getAttribute("y"))/this.board.unitY),t.getElementsByTagName("coords")[0])e.x=parseFloat(t.getElementsByTagName("coords")[0].getAttribute("x")),e.y=parseFloat(t.getElementsByTagName("coords")[0].getAttribute("y")),e.z=parseFloat(t.getElementsByTagName("coords")[0].getAttribute("z"));else if(t.getElementsByTagName("startPoint")[0])t.getElementsByTagName("startPoint")[0].getAttribute("exp")?(r=this.board.select(t.getElementsByTagName("startPoint")[0].getAttribute("exp")),e.x=function(){return r.X()+a.x},e.y=function(){return r.Y()-a.y},e.z=!1):(e.x=parseFloat(t.getElementsByTagName("startPoint")[0].getAttribute("x")),e.y=parseFloat(t.getElementsByTagName("startPoint")[0].getAttribute("y")),e.z=parseFloat(t.getElementsByTagName("startPoint")[0].getAttribute("z")));else{if(!t.getElementsByTagName("absoluteScreenLocation")[0])return!1;s=new JXG.Coords(JXG.COORDS_BY_SCREEN,[parseFloat(t.getElementsByTagName("absoluteScreenLocation")[0].getAttribute("x")),parseFloat(t.getElementsByTagName("absoluteScreenLocation")[0].getAttribute("y"))],this.board),e.x=s.usrCoords[1]+a.x,e.y=s.usrCoords[2]+a.y,e.z=!1}return e},visualProperties:function(e,t){var r=e.getElementsByTagName("show"),s=e.getElementsByTagName("pointSize"),a=e.getElementsByTagName("pointStyle"),i=e.getElementsByTagName("slopeTriangleSize"),o=e.getElementsByTagName("lineStyle"),n=e.getElementsByTagName("labelOffset"),c=e.getElementsByTagName("trace"),l=e.getElementsByTagName("fix");return r.length>0&&r[0].getAttribute("object")&&(t.visible=JXG.str2Bool(r[0].getAttribute("object"))),r.length>0&&r[0].getAttribute("label")&&(t.withLabel=JXG.str2Bool(r[0].getAttribute("label"))),s.length>0&&s[0].getAttribute("val")&&(t.size=parseInt(s[0].getAttribute("val"),10)),a.length>0&&a[0].getAttribute("val")&&(t.styleGGB=parseInt(a[0].getAttribute("val"),10)),0===t.styleGGB||2===t.styleGGB?(t.face="circle",0===t.styleGGB?(t.fillColor=t.strokeColor,t.fillOpacity=1,t.highlightFillColor=t.strokeColor,t.highlightFillOpacity=1,t.strokeColor="black",t.strokeWidth=1):2===t.styleGGB&&(t.fillColor="none")):1===t.styleGGB?t.face="x":3===t.styleGGB?(t.face="+",t.strokeOpacity=1):4===t.styleGGB||5===t.styleGGB?(t.face="diamond",4===t.styleGGB?(t.fillColor=t.strokeColor,t.fillOpacity=1):5===t.styleGGB&&(t.fillColor="none")):6===t.styleGGB?(t.face="triangleUp",t.fillColor=t.strokeColor,t.fillOpacity=1):7===t.styleGGB?(t.face="triangleDown",t.fillColor=t.strokeColor,t.fillOpacity=1):8===t.styleGGB?(t.face="triangleRight",t.fillColor=t.strokeColor,t.fillOpacity=1):9===t.styleGGB&&(t.face="triangleLeft",t.fillColor=t.strokeColor,t.fillOpacity=1),i.length>0&&(t.slopeWidth=i[0].getAttribute("val")),o.length>0&&(t.strokeWidth=Math.round(parseFloat(o[0].getAttribute("thickness"))/2),t.dashGGB=o[0].getAttribute("type")),t.strokeWidth&&(t.highlightStrokeWidth=t.strokeWidth+1),"0"===t.dashGGB?t.dash=0:"10"===t.dashGGB?t.dash=2:"15"===t.dashGGB?t.dash=3:"20"===t.dashGGB?t.dash=1:"30"===t.dashGGB&&(t.dash=6),n.length>0&&(t.labelX=parseFloat(n[0].getAttribute("x")),t.labelY=parseFloat(n[0].getAttribute("y"))),c.length>0&&(t.trace=c[0].getAttribute("val")),l.length>0&&(t.fixed=l[0].getAttribute("val")),t},getElement:function(e,t){var r,s,a;for(t=t||!1,s=0;s<this.tree.getElementsByTagName("construction").length;s++)if(!1===t){for(a=0;a<this.tree.getElementsByTagName("construction")[s].getElementsByTagName("element").length;a++)if(e===(r=this.tree.getElementsByTagName("construction")[s].getElementsByTagName("element")[a]).getAttribute("label"))return r}else for(a=0;a<this.tree.getElementsByTagName("construction")[s].getElementsByTagName("expression").length;a++){if(e===(r=this.tree.getElementsByTagName("construction")[s].getElementsByTagName("expression")[a]).getAttribute("label"))return r;if(e===r.getAttribute("exp"))return this.getElement(r.getAttribute("label"))}return!1},checkElement:function(e){var t;if(!JXG.exists(this.ggbElements[e])||""===this.ggbElements[e]){if(!(t=this.getElement(e)||this.getElement(e,!0))){var r,s,a,i=this.ggbParse(e);for(r=0;r<this.tree.getElementsByTagName("construction").length;r++)for(s=0;s<this.tree.getElementsByTagName("construction")[r].getElementsByTagName("expression").length;s++){a=this.tree.getElementsByTagName("construction")[r].getElementsByTagName("expression")[s];var o=this.ggbParse(a.getAttribute("exp"));JXG.isArray(i)&&JXG.isArray(o)&&i[0]==o[0]&&i[1]==o[1]&&(t=this.getElement(a.getAttribute("label")))}if(!t)return new Function("return "+i+";")}this.ggbElements[e]=this.writeElement(t)}return this.ggbElements[e]},functionParse:function(e,t){var r,s,a,i,o,n;switch(e){case"c":if(t.match(/[a-zA-Z0-9\']+\([a-zA-Z0-9]+[a-zA-Z0-9,\ ]*\)[\ ]*[=][\ ]*[a-zA-Z0-9\+\-\*\/ \( \) \u005E]+/)){for(r=t.split("(")[1].split(")")[0].split(", "),a=[],i=0;i<r.length;i++)a.push("__"+r[i]);for(s=t.split("=")[1],i=0;i<r.length;i++)s="x"===r[i]?s.replace(/(?![e])x(?!\()(?![p])/g,"__"+r[i]):"y"===r[i]?s.replace(/(?![e])y(?!\()(?![p])/g,"__"+r[i]):s.replace(new RegExp(r[i],"g"),"__"+r[i]);if(s=s.replace(/-__/g,"-1*__"),this.format<=3.01){for(o=s.split(" "),n="",i=0;i<o.length;i++)o.length!==i+1&&(o[i].search(/\)$/)>-1||o[i].search(/[0-9]+$/)>-1||o[i].search(/[a-zA-Z]+(_*[a-zA-Z0-9]+)*$/)>-1)&&(o[i+1].search(/^\(/)>-1||o[i+1].search(/^[0-9]+/)>-1||o[i+1].search(/^[a-zA-Z]+(_*[a-zA-Z0-9]+)*/)>-1||o[i+1].search(/__[a-zA-Z0-9]+/)>-1)&&(o[i]=o[i]+"*"),n+=o[i];s=n}return a.push(s),a}return t;case"s":return["__x",t=t.replace(/(?![e])x(?!\()(?![p])/g,"__x")];default:if(this.format<=3.01){for(o=t.split(" "),n="",i=0;i<o.length;i++)o.length!==i+1&&(o[i].search(/\)$/)>-1||o[i].search(/[0-9]+$/)>-1||o[i].search(/[a-zA-Z]+(_*[a-zA-Z0-9]+)*$/)>-1)&&(o[i+1].search(/^\(/)>-1||o[i+1].search(/^[0-9]+/)>-1||o[i+1].search(/^[a-zA-Z]+(\_*[a-zA-Z0-9]+)*/)>-1||o[i+1].search(/\_\_[a-zA-Z0-9]+/)>-1)&&(o[i]=o[i]+"*"),n+=o[i];t=n}return t}},writeBoard:function(){var e=this.tree.getElementsByTagName("euclidianView")[0],t=e.getElementsByTagName("coordSystem")[0],r=this.tree.getElementsByTagName("gui")[0],s=e.getElementsByTagName("evSettings")[0];this.board.origin={},this.board.origin.usrCoords=[1,0,0],this.board.origin.scrCoords=[1,parseInt(t.getAttribute("xZero"),10),parseInt(t.getAttribute("yZero"),10)],this.board.unitX=t.getAttribute("scale")?parseInt(t.getAttribute("scale"),10):1,this.board.unitY=t.getAttribute("yscale")?parseInt(t.getAttribute("yscale"),10):this.board.unitX,this.board.fontSize=r&&r.getElementsByTagName("font")[0]?parseInt(r.getElementsByTagName("font")[0].getAttribute("size"),10):12,JXG.boards[this.board.id]=this.board,this.board.renderer.enhancedRendering=!0,"true"===s.getAttribute("grid")&&this.board.create("grid"),s.getAttribute("axes")&&("true"===s.getAttribute("axes")?(this.ggbElements.xAxis=this.board.create("axis",[[0,0],[1,0]],{strokeColor:"transparent",minorTicks:0}),this.ggbElements.yAxis=this.board.create("axis",[[0,0],[0,1]],{strokeColor:"black",minorTicks:0})):(this.ggbElements.xAxis=this.board.create("axis",[[0,0],[1,0]],{strokeColor:"transparent",ticks:{drawLabels:!1}}),this.ggbElements.yAxis=this.board.create("axis",[[0,0],[0,1]],{strokeColor:"transparent",ticks:{drawLabels:!1}})))},writeElement:function(e,t,r){var s,a,i,o,n,c,l,h,g,b,d,u,m,p,G,A,y,C,X,f,J,E,k,P,B,x,N,T,F,v,S,w,O,L,_,I,z,R,Y,V,W,M,Z,D,$,U,j,q=this,H=function(e){return function(){return e}},K=function(e){return function(){return JXG.Math.Numerics.root(B.Y,e,B)}};switch(T=JXG.isArray(e)?e[0]:e,F={},v={},JXG.debug(T),F.type=T&&T.attributes&&!JXG.exists(r)?T.getAttribute("type").toLowerCase():r,F.label=T.getAttribute("label"),v.name=F.label,JXG.debug("Constructing "+v.name+"("+F.type+"):"),F.type){case"point":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),v=this.visualProperties(T,v),this.getElement(v.name,!0)?(S=this.getElement(v.name,!0).getAttribute("exp"),w=this.ggbParse(S),F.x=new Function("return "+w[0]+";"),F.y=new Function("return "+w[1]+";")):F=this.coordinates(F,T),JXG.exists(v.styleGGB)||(v.face="circle",v.fillColor=v.strokeColor,v.fillOpacity=1,v.highlightFillColor=v.strokeColor,v.highlightFillOpacity=1,v.strokeColor="black",v.strokeWidth=1),JXG.debug(F),JXG.debug(t);try{return _=/Circle\[\s*(\w+)\s*,\s*([\d\.]+)\s*\]/.exec(t),I=/Circle\[\s*(\w+)\s*,\s*(\w+)\s*\]/.exec(t),JXG.exists(t)?JXG.exists(_)&&3===_.length?(R=this.checkElement(_[1]),Y=this.board.create("circle",[R,parseFloat(_[2])],{fillColor:"none",visible:!1,name:""}),s=this.board.create("glider",[F.x,F.y,Y],v)):JXG.exists(I)&&3===I.length?(R=this.checkElement(I[1]),l=this.checkElement(I[2]),Y=this.board.create("circle",[R,function(){return l.Value()}],{fillColor:"none",visible:!1,name:""}),s=this.board.create("glider",[F.x,F.y,Y],v)):s=JXG.isArray(t)?this.board.create("glider",[F.x,F.y,t[0]],v):this.board.create("glider",[F.x,F.y,t],v):s=this.board.create("point",[F.x,F.y],v),s}catch(e){return JXG.debug("* Err: Point "+v.name),!1}break;case"segment":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v),void 0===t?t=[parseFloat(T.getElementsByTagName("coords")[0].getAttribute("z")),parseFloat(T.getElementsByTagName("coords")[0].getAttribute("x")),parseFloat(T.getElementsByTagName("coords")[0].getAttribute("y"))]:this.board.select(t[1].id).elementClass===JXG.OBJECT_CLASS_LINE&&(f="parallel");try{return JXG.debug("* Segment: ("+v.name+") First: "+t[0].name+", Last: "+t[1].name),v.straightFirst=!1,v.straightLast=!1,s=this.board.create("line",t,v)}catch(e){return JXG.debug("* Err: Segment "+v.name+" First: "+t[0].name+", Last: "+t[1].name),!1}break;case"line":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v),f="line",t?this.board.select(t[1].id).elementClass===JXG.OBJECT_CLASS_LINE&&(f="parallel"):t=[parseFloat(T.getElementsByTagName("coords")[0].getAttribute("z")),parseFloat(T.getElementsByTagName("coords")[0].getAttribute("x")),parseFloat(T.getElementsByTagName("coords")[0].getAttribute("y"))];try{return s=this.board.create(f,t,v)}catch(e){return JXG.debug("* Err: Line "+v.label),!1}break;case"orthogonalline":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v);try{return JXG.debug("* Orthogonalline: First: "+t[0].id+", Last: "+t[1].id),s=this.board.create("normal",t,v)}catch(e){return JXG.debug("* Err: Orthogonalline "+v.label),!1}break;case"polygon":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v),3===t.length&&4!==e.length&&(t[2]=parseInt(t[2],10),f="regular");try{for(JXG.debug("* Polygon: First: "+t[0].name+", Second: "+t[1].name+", Third: "+t[2]),N=[],x=[],L="regular"===f?e.length-t[2]+2:e.length,h=1;h<L;h++)N[h-1]={},x[h-1]={},N[h-1].id="",N[h-1].name=e[h].getAttribute("label"),x[h-1]=this.colorProperties(e[h],x[h-1]),x[h-1]=this.visualProperties(e[h],x[h-1]);if(v.borders=N,O=[],"regular"===f)for(O.push(t[0]),O.push(t[1]),h=t[2]+1;h<e.length;h++)e[h].attributes?O.push(this.checkElement(e[h].getAttribute("label"))):O.push(e[h]);else for(h=0;h<t.length;h++)"object"==typeof t[h]&&O.push(t[h]);for(s="regular"===f?this.board.create("regularpolygon",O,v):this.board.create("polygon",O,v),h=0;h<s.borders.length;h++)x[h].withLabel&&s.borders[h].createLabel(),s.borders[h].setAttribute(x[h]);return s}catch(e){return JXG.debug("* Err: Polygon "+v.name),!1}break;case"intersect":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v);try{return JXG.debug("* Intersection: First: "+t[0].name+", Second: "+t[1].name),JXG.exists(v.styleGGB)||(v.face="circle",v.fillColor=v.strokeColor,v.fillOpacity=1,v.highlightFillColor=v.strokeColor,v.highlightFillOpacity=1,v.strokeColor="black",v.strokeWidth=1),1===e.length?s=this.board.create("intersection",[t[0],t[1],0],v):(s=this.board.create("intersection",[t[0],t[1],1],v),G={},G=this.colorProperties(e[1],G),(G=this.visualProperties(e[1],G)).name=e[1].getAttribute("label"),b=this.board.create("otherintersection",[t[0],t[1],s],G),this.ggbElements[G.name]=b),s}catch(e){return JXG.debug("* Err: Intersection "+v.name),!1}break;case"distance":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v);try{return JXG.debug("* Distance: First: "+t[0].name+", Second: "+t[1].name),l=this.board.create("midpoint",t,{visible:"false"}),v.visible="true",(s=this.board.create("text",[function(){return l.X()},function(){return l.Y()},function(){return"<span style='text-decoration: overline'>"+t[0].name+t[1].name+"</span> = "+JXG.trimNumber(JXG.toFixed(q.board.select(t[0].id).Dist(q.board.select(t[1].id)),q.decimals))}],v)).Value=function(){return q.board.select(t[0].id).Dist(q.board.select(t[1].id))},s}catch(e){return JXG.debug("* Err: Distance "+v.name),!1}break;case"vector":if(v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v),T.getElementsByTagName("startPoint")[0])W=t&&2===t.length?this.checkElement(t[1].name):[parseFloat(T.getElementsByTagName("coords")[0].getAttribute("x")),parseFloat(T.getElementsByTagName("coords")[0].getAttribute("y"))],T.getElementsByTagName("startPoint")[0].getAttribute("x")&&T.getElementsByTagName("startPoint")[0].getAttribute("y")?V=[parseFloat(T.getElementsByTagName("startPoint")[0].getAttribute("x")),parseFloat(T.getElementsByTagName("startPoint")[0].getAttribute("y"))]:T.getElementsByTagName("startPoint")[0].getAttribute("exp")&&(P=T.getElementsByTagName("startPoint")[0].getAttribute("exp"),V=this.checkElement(P));else if(t&&0!==t.length)V=t[0],W=t[1];else if(S=this.getElement(T.getAttribute("label"),!0))return S=S.getAttribute("exp"),S=this.ggbParse(S),S=JXG.isArray(S)?[new Function("return "+S[1]+";"),new Function("return "+S[2]+";")]:new Function("return "+S+";"),JXG.debug("exp: "+S),s=this.board.create("arrow",[[0,0],[S[0],S[1]]],v);try{return JXG.debug("* Vector: First: "+v.name),s=this.board.create("arrow",[V,W],v)}catch(e){return JXG.debug("* Err: Vector "+v.name+W),!1}break;case"rotate":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v);try{return JXG.debug("* Rotate: First: "+t[0].name+", Second: "+t[1]),v.type="rotate",JXG.exists(v.styleGGB)||(v.face="circle",v.fillColor=v.strokeColor,v.fillOpacity=1,v.highlightFillColor=v.strokeColor,v.highlightFillOpacity=1,v.strokeColor="black",v.strokeWidth=1),c=this.board.create("transform",[parseInt(t[1],10)*Math.PI/180,t[2]],{type:"rotate"}),s=this.board.create("point",[t[0],c],v)}catch(e){return JXG.debug("* Err: Rotate "+v.name),!1}break;case"dilate":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v);try{return JXG.debug("* Dilate: First: "+t[0].name+", Second: "+t[1]),v.type="rotate",k=parseInt(t[1],10),E=this.board.create("transform",[k,k],{type:"scale"}),J=this.board.create("transform",[function(){return(1-k)*t[2].X()},function(){return(1-k)*t[2].Y()}],{type:"translate"}),JXG.exists(v.styleGGB)||(v.face="circle",v.fillColor=v.strokeColor,v.fillOpacity=1,v.highlightFillColor=v.strokeColor,v.highlightFillOpacity=1,v.strokeColor="black",v.strokeWidth=1),s=this.board.create("point",[t[0],[E,J]],v)}catch(e){return JXG.debug("* Err: Dilate "+v.name),!1}break;case"translate":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v);try{return c=this.board.create("transform",[function(){return t[1].point2.X()-t[1].point1.X()},function(){return t[1].point2.Y()-t[1].point1.Y()}],{type:"translate"}),JXG.exists(v.styleGGB)||(v.face="circle",v.fillColor=v.strokeColor,v.fillOpacity=1,v.highlightFillColor=v.strokeColor,v.highlightFillOpacity=1,v.strokeColor="black",v.strokeWidth=1),s=this.board.create("point",[t[0],c],v)}catch(e){return JXG.debug("* Err: Translate "+v.name),!1}break;case"mirror":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v),JXG.isPoint(this.board.select(t[1].id))?f="mirrorpoint":this.board.select(t[1].id).elementClass===JXG.OBJECT_CLASS_LINE&&(f="reflection");try{return JXG.debug("* Mirror: First: "+t[0].name+", Second: "+t[1].name),s=this.board.create(f,[t[0],t[1]],v)}catch(e){return JXG.debug("* Err: Mirror "+v.name),!1}break;case"circle":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v);try{return JXG.debug("* Circle: First: "+t[0].name+", Second: "+t[1]),s=this.board.create("circle",t,v)}catch(e){return JXG.debug("* Err: Circle "+v.name),!1}break;case"circlearc":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v);try{return JXG.debug("* CircleArc: First: "+t[0].name+", Second: "+t[1].name+", Third: "+t[2].name),s=this.board.create("arc",t,v)}catch(e){return JXG.debug("* Err: CircleArc "+v.name),!1}break;case"ellipse":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v);try{return JXG.debug("* Ellipse: First: "+t[0].name+", Second: "+t[1].name+", Third: "+t[2]),parseInt(t[2],10)===t[2]&&(t[2]=2*parseInt(t[2],10)),s=this.board.create("ellipse",t,v)}catch(e){return JXG.debug("* Err: Ellipse "+v.name),!1}break;case"conic":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v);try{if(t&&5===t.length)s=this.board.create("conic",t,v);else if(T.getElementsByTagName("matrix")){for(l=[],h=0;h<T.getElementsByTagName("matrix")[0].attributes.length;h++)l[h]=parseFloat(T.getElementsByTagName("matrix")[0].attributes[h].value);s=this.board.create("conic",l,v)}return s}catch(e){return JXG.debug("* Err: Conic "+v.name),!1}break;case"circlesector":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v);try{return JXG.debug("* CircleSector: First: "+t[0].name+", Second: "+t[1].name+", Third: "+t[2].name),s=this.board.create("sector",[t[0],t[1],t[2]],v)}catch(e){return JXG.debug("* Err: CircleSector "+v.name),!1}break;case"linebisector":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v);try{return JXG.debug("* LineBiSector (Mittelsenkrechte): First: "+t[0].name),l=this.board.create("midpoint",t,{visible:!1}),JXG.isPoint(this.board.select(t[0].id))&&JXG.isPoint(this.board.select(t[1].id))?(c=this.board.create("line",t,{visible:"false"}),s=this.board.create("perpendicular",[l,c],v)):s=this.board.create("perpendicular",[l,t[0]],v),s}catch(e){return JXG.debug("* Err: LineBiSector (Mittelsenkrechte) "+v.name),!1}break;case"ray":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v);try{return JXG.debug("* Ray: First: "+t[0].name),v.straightFirst=!0,v.straightLast=!1,s=this.board.create("line",[t[1],t[0]],v)}catch(e){return JXG.debug("* Err: Ray "+v.name),!1}break;case"tangent":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v);try{switch(JXG.debug("* Tangent: First: "+t[0].name+", Sec.: "+t[1].name+"("+t[1].type+")"),t[1].type){case 1330923344:return t[0].makeGlider(t[1]),s=this.board.create("tangent",[t[0]],v);case 1330922316:case 1330922319:return X=this.board.create("polar",[t[1],t[0]],{visible:!1}),C=this.board.create("intersection",[t[1],X,0],{visible:!1}),y=this.board.create("intersection",[t[1],X,1],{visible:!1}),A=this.board.create("line",[t[0],C],v),G={},G=this.colorProperties(e[1],G),(G=this.visualProperties(e[1],G)).name=e[1].getAttribute("label"),n=this.board.create("line",[t[0],y],G),this.ggbElements[G.name]=n,[A,n]}}catch(e){return JXG.debug("* Err: Tangent "+v.name+" "+G.name),!1}break;case"circumcirclearc":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v);try{return JXG.debug("* CircumcircleArc: First: "+t[0].name),s=this.board.create("circumcirclearc",t,v)}catch(e){return JXG.debug("* Err: CircumcircleArc "+v.name),!1}break;case"circumcirclesector":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v);try{return JXG.debug("* CircumcircleSector: First: "+t[0].name),s=this.board.create("circumcirclesector",[t[0],t[1],t[2]],v)}catch(e){return JXG.debug("* Err: CircumcircleSector "+v.name),!1}break;case"semicircle":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v);try{return JXG.debug("* Semicircle: First: "+t[0].name),s=this.board.create("semicircle",[t[0],t[1]],v)}catch(e){return JXG.debug("* Err: Semicircle "+v.name),!1}break;case"angle":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v);try{return JXG.debug("* Angle: First: "+t[0].name),s=this.board.create("angle",t,v)}catch(e){return JXG.debug("* Err: Angle "+v.name),!1}break;case"angularbisector":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),(v=this.visualProperties(T,v)).straightFirst=!0,v.straightLast=!0;try{return JXG.debug("* Angularbisector: First: "+t[0].name),s=this.board.create("bisector",t,v)}catch(e){return JXG.debug("* Err: Angularbisector "+v.name),!1}break;case"numeric":if(0===T.getElementsByTagName("slider").length)return(S=this.getElement(T.getAttribute("label"),!0))&&(S=S.getAttribute("exp"),S=this.functionParse("",S),S=this.ggbParse(S)),this.board.ggb[v.name]=new Function("return "+S+";"),JXG.debug("value: "+this.board.ggb[v.name]()),this.board.ggb[v.name];if(v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),v=this.visualProperties(T,v),1===T.getElementsByTagName("slider").length){M=parseFloat(T.getElementsByTagName("slider")[0].getAttribute("x")),Z=parseFloat(T.getElementsByTagName("slider")[0].getAttribute("y")),L=parseFloat(T.getElementsByTagName("slider")[0].getAttribute("width")),T.getElementsByTagName("slider")[0].getAttribute("absoluteScreenLocation")&&"true"===T.getElementsByTagName("slider")[0].getAttribute("absoluteScreenLocation")&&(M=(p=new JXG.Coords(JXG.COORDS_BY_SCREEN,[M,Z],this.board)).usrCoords[1],Z=p.usrCoords[2]),"true"===T.getElementsByTagName("slider")[0].getAttribute("horizontal")?(T.getElementsByTagName("slider")[0].getAttribute("absoluteScreenLocation")&&"true"===T.getElementsByTagName("slider")[0].getAttribute("absoluteScreenLocation")&&(L/=this.board.unitX),D=M+L,$=Z):(T.getElementsByTagName("slider")[0].getAttribute("absoluteScreenLocation")&&"true"===T.getElementsByTagName("slider")[0].getAttribute("absoluteScreenLocation")&&(L/=this.board.unitY),D=M,$=Z+L),T.getElementsByTagName("animation")[0]&&(v.snapWidth=parseFloat(T.getElementsByTagName("animation")[0].getAttribute("step")));try{return JXG.debug("* Numeric: First: "+v.name),v.withTicks=!1,s=this.board.create("slider",[[M,Z],[D,$],[parseFloat(T.getElementsByTagName("slider")[0].getAttribute("min")),parseFloat(T.getElementsByTagName("value")[0].getAttribute("val")),parseFloat(T.getElementsByTagName("slider")[0].getAttribute("max"))]],v)}catch(e){return JXG.debug("* Err: Numeric "+v.name),!1}}break;case"midpoint":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v);try{return JXG.exists(v.styleGGB)||(v.face="circle",v.fillColor=v.strokeColor,v.fillOpacity=1,v.highlightFillColor=v.strokeColor,v.highlightFillOpacity=1,v.strokeColor="black",v.strokeWidth=1),s=this.board.create("midpoint",t,v),JXG.debug("* Midpoint ("+s.id+"): "+v.name+"("+F.x+", "+F.y+")"),s}catch(e){return JXG.debug("* Err: Midpoint "+v.name),!1}break;case"center":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v);try{return JXG.exists(v.styleGGB)||(v.face="circle",v.fillColor=v.strokeColor,v.fillOpacity=1,v.highlightFillColor=v.strokeColor,v.highlightFillOpacity=1,v.strokeColor="black",v.strokeWidth=1),s=this.board.create("point",[function(){return q.board.select(t[0].id).center.X()},function(){return q.board.select(t[0].id).center.Y()}],v),JXG.debug("* Center ("+s.id+"): "+v.name+"("+F.x+", "+F.y+")"),s}catch(e){return JXG.debug("* Err: Center "+v.name),!1}break;case"function":for(v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v),this.getElement(v.name,!0)?(U=this.getElement(v.name,!0).getAttribute("exp"),U=this.functionParse("c",U)):(U=t[0],U=this.functionParse("s",U)),JXG.debug(U),L=U.length,U[U.length-1]="return "+this.ggbParse(U[U.length-1])+";",JXG.debug(U),j=[t&&t[1]?t[1]:null,t&&t[2]?t[2]:null],z=/([x|y])\((\w+)\)/,h=0;h<2;h++)(_=z.exec(j[h]))&&(j[h]=_[1].toUpperCase()+"("+_[2]+")");try{return 1===L?s=this.board.create("functiongraph",[new Function(U[0]),j[0],j[1]],v):2===L?s=this.board.create("functiongraph",[new Function(U[0],U[1]),j[0],j[1]],v):3===L?s=this.board.create("functiongraph",[new Function(U[0],U[1],U[2]),j[0],j[1]],v):4===L?s=this.board.create("functiongraph",[new Function(U[0],U[1],U[2],U[3]),j[0],j[1]],v):5===L&&(s=this.board.create("functiongraph",[new Function(U[0],U[1],U[2],U[3],U[4]),j[0],j[1]],v)),s}catch(e){return JXG.debug("* Err: Functiongraph "+v.name),!1}break;case"polar":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v);try{return JXG.debug("* Polar: First: "+t[0].name+", Sec.: "+t[1].name),s=this.board.create("polar",t,v)}catch(e){return JXG.debug("* Err: Polar "+v.name),!1}break;case"slope":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v);try{return JXG.debug("* Slope ("+v.name+"): First: "+t[0].name),m=parseInt(v.slopeWidth,10)||1,u=t[0].glider||t[0].point1,b=this.board.create("point",[function(){return m+u.X()},function(){return u.Y()}],{visible:!1}),d=this.board.create("segment",[u,b],{visible:!1}),g=this.board.create("normal",[d,d.point2],{visible:!1}),h=this.board.create("intersection",[t[0],g,0],{visible:!1}),l=this.board.create("midpoint",[d.point2,h],{visible:!1}),c=this.board.create("text",[function(){return l.X()},function(){return l.Y()},function(){return" "+(m>1?m.toString():"")+" "+this.name+" = "+JXG.trimNumber(JXG.toFixed(m*t[0].getSlope(),q.decimals))}],v),v.name="",n=this.board.create("text",[function(){return(u.X()+b.X())/2},function(){return u.Y()},function(){return"<br/>"+m}],v),c.Value=function(){return t[0].getSlope()},(o=this.board.create("polygon",[u,b,h],v)).borders[2].setAttribute({visible:!1}),o.borders[0].setAttribute({strokeColor:v.fillColor,strokeWidth:v.strokeWidth,highlightStrokeColor:v.fillColor,dash:v.dash}),o.borders[1].setAttribute({strokeColor:v.fillColor,strokeWidth:v.strokeWidth,highlightStrokeColor:v.fillColor,dash:v.dash}),c}catch(e){return JXG.debug("* Err: Slope "+v.name),!1}break;case"text":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v),a="";try{if(T.getElementsByTagName("isLaTeX")[0]&&"true"===T.getElementsByTagName("isLaTeX")[0].getAttribute("val")){for(this.board.options.text.useASCIIMathML=!0,z=(c=this.getElement(v.name,!0).getAttribute("exp")).match(/(.*?)" \+ (.+) \+ "(.*)/);z;)a="string"==typeof(i=this.ggbParse(RegExp.$2))?a+RegExp.$1+i:a+RegExp.$1+'" + JXG.trimNumber(JXG.toFixed('+i+", "+this.decimals+')) + "',z=(c=RegExp.$3).match(/(.*?)" \+ (.+) \+ "(.*)/);(z=c.match(/(.*?)" \+ (.+)/))?a=a+RegExp.$1+'" + JXG.trimNumber(JXG.toFixed('+this.ggbParse(RegExp.$2)+", "+this.decimals+"))":a+=c,JXG.debug("Text: "+a),s=this.board.create("text",[F.x,F.y,new Function("return "+a+";")],v)}else JXG.debug(this.getElement(v.name,!0).getAttribute("exp")),c=this.functionParse(!1,this.getElement(v.name,!0).getAttribute("exp")),c=this.ggbParse(c),JXG.debug(c[1]),s=JXG.isArray(c)?this.board.create("text",[F.x,F.y,new Function("return "+c[0]+' + " " + JXG.trimNumber(JXG.toFixed(parseFloat('+c[1]+", "+this.decimals+"));")],v):this.board.create("text",[F.x,F.y,c],v);return JXG.debug("* Text: "+c),s}catch(e){return JXG.debug("* Err: Text: "+c,e,e.stack),!1}break;case"root":for(v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v),h=0;h<e.length;h++)e[h]=this.checkElement(e[h].getAttribute("label"));for(B=JXG.isArray(t)?t[0]:t,h=0;h<e.length;h++)e[h].addConstraint([K(e[h].X()),H(0)]);return e;case"integral":v=this.boardProperties(F,T,v),v=this.colorProperties(T,v),F=this.coordinates(F,T),v=this.visualProperties(T,v);try{return JXG.debug("* Integral: First: "+t[0].name+", Sec.: "+t[1].name+", Thir.: "+t[2].name),JXG.debug([t[1](),t[2]()]),s=this.board.create("integral",[this.board.select(t[0]),[t[1],t[2]]],v)}catch(e){return JXG.debug("* Err: Integral "+v.name+W),!1}break;default:return!1}},read:function(){var e,t,r,s,a,i,o,n,c,l,h,g;for(this.writeBoard(),this.setDefaultOptions(),e=this.tree.getElementsByTagName("construction"),a=0;a<e.length;a++){for(n=e[a].getElementsByTagName("command"),i=0;i<n.length;i++){for(r=n[i],JXG.debug("now i'll parse the command:"),JXG.debug(r),c=[],s=0;s<r.getElementsByTagName("input")[0].attributes.length;s++)(t=r.getElementsByTagName("input")[0].attributes[s].value).match(/\u00B0/)||!t.match(/\D/)||t.match(/Circle/)||"Function"===r.getAttribute("name")||t===parseFloat(t)?c[s]=t:c[s]="xAxis"===t||"yAxis"===t?this.ggbElements[t]:this.checkElement(t);for(l=[],h=r.getElementsByTagName("output")[0].attributes[0].value,s=0;s<r.getElementsByTagName("output")[0].attributes.length;s++)t=r.getElementsByTagName("output")[0].attributes[s].value,l[s]=this.getElement(t);if((!JXG.exists(this.ggbElements[h])||""===this.ggbElements[h])&&(this.ggbElements[h]=this.writeElement(l,c,r.getAttribute("name").toLowerCase()),this.ggbElements[h].borders))for(s=0;s<this.ggbElements[h].borders.length;s++)this.ggbElements[this.ggbElements[h].borders[s].name]=this.ggbElements[h].borders[s]}for(JXG.debug("Restesammler: "),g=e[a].getElementsByTagName("element"),i=0;i<g.length;i++)if(t=(r=g[i]).getAttribute("label"),(!JXG.exists(this.ggbElements[t])||""===this.ggbElements)&&(this.ggbElements[t]=this.writeElement(r),o=this.getElement(t,!0)))switch(r.getAttribute("type")){case"text":case"function":break;default:this.ggbParse(o.getAttribute("exp"),t)}}this.board.unsuspendUpdate(),this.board.fullUpdate()},utf8replace:function(e){return e=e.replace(/\u03C0/g,"PI").replace(/\u00B2/g,"^2").replace(/\u00B3/g,"^3").replace(/\u225F/g,"==").replace(/\u2260/g,"!=").replace(/\u2264/g,"<=").replace(/\u2265/g,">=").replace(/\u2227/g,"&&").replace(/\u2228/g,"//")},prepareString:function(e){var t,r,s,a;if("PK"!==e.slice(0,2)&&0!==e.indexOf("<")&&("PK"!==(a=JXG.Util.Base64.decode(e)).slice(0,2)&&(a=JXG.Util.Base64.decode(e,!0)),e=a),0!==e.indexOf("<")){for(r=[],s=e.length,t=0;t<s;t++)r[t]=JXG.Util.UTF8.asciiCharCodeAt(e,t);e=new JXG.Util.Unzip(r).unzipFile("geogebra.xml")}return e=JXG.Util.UTF8.decode(e),e=this.utf8replace(e)},isGGBVector:function(e){return JXG.isArray(e)&&3===e.length&&1===e[0]}}),JXG.registerReader(JXG.GeogebraReader,["ggb","geogebra"])}();
|
package/distrib/geonext.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
JSXGraph 1.
|
|
2
|
+
JSXGraph 1.4.1
|
|
3
3
|
|
|
4
|
-
Copyright 2008-
|
|
4
|
+
Copyright 2008-2022
|
|
5
5
|
Matthias Ehmann,
|
|
6
6
|
Michael Gerhaeuser,
|
|
7
7
|
Carsten Miller,
|
|
@@ -58,4 +58,4 @@
|
|
|
58
58
|
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
59
59
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
60
60
|
*/
|
|
61
|
-
(function(){"use strict";JXG.GeonextReader=function(board,str){var content;this.board=board;content=this.prepareString(str);this.tree=JXG.XML.parse(content)};JXG.extend(JXG.GeonextReader.prototype,{changeOriginIds:function(board,id){if(id==="gOOe0"||id==="gXOe0"||id==="gYOe0"||id==="gXLe0"||id==="gYLe0"){return board.id+id}return id},gEBTN:function(node,tag,idx,fc){var tmp=[];if(!JXG.exists(node||!node.getElementsByTagName)){return node}if(!JXG.exists(fc)){fc=true}idx=idx||0;if(node.getElementsByTagName){tmp=node.getElementsByTagName(tag)}if(tmp.length>0){tmp=tmp[idx];if(fc&&tmp.firstChild){tmp=tmp.firstChild.data}}return tmp},colorProperties:function(gxtEl,Data){var rgbo,color=this.gEBTN(Data,"color",0,false);rgbo=JXG.rgba2rgbo(this.gEBTN(color,"stroke"));gxtEl.strokeColor=rgbo[0];gxtEl.strokeOpacity=rgbo[1];rgbo=JXG.rgba2rgbo(this.gEBTN(color,"lighting"));gxtEl.highlightStrokeColor=rgbo[0];gxtEl.highlightStrokeOpacity=rgbo[1];rgbo=JXG.rgba2rgbo(this.gEBTN(color,"fill"));gxtEl.fillColor=rgbo[0];gxtEl.fillOpacity=rgbo[1];gxtEl.highlightFillColor=gxtEl.fillColor;gxtEl.highlightFillOpacity=gxtEl.fillOpacity;rgbo=JXG.rgba2rgbo(this.gEBTN(color,"label"));gxtEl.labelColor=rgbo[0];gxtEl.withLabel=rgbo[1]>0;gxtEl.labelOpacity=rgbo[1];gxtEl.colorDraft=JXG.rgba2rgbo(this.gEBTN(color,"draft"))[0];gxtEl.colorStroke=gxtEl.strokeColor;gxtEl.colorFill=gxtEl.fillColor;gxtEl.colorLabel=gxtEl.labelColor;return gxtEl},firstLevelProperties:function(gxtEl,Data){var n,key,arr;if(!JXG.exists(Data)||!JXG.exists(Data.childNodes)){return gxtEl}arr=Data.childNodes;for(n=0;n<arr.length;n++){if(JXG.exists(arr[n].firstChild)&&arr[n].nodeName!=="data"&&arr[n].nodeName!=="straight"){key=arr[n].nodeName;if(key==="width"){key="strokewidth"}gxtEl[key]=arr[n].firstChild.data}}return gxtEl},defProperties:function(gxtEl,Data){if(Data.nodeType===3||Data.nodeType===8){return null}gxtEl.ident=Data.nodeName;if(gxtEl.ident==="text"||gxtEl.ident==="intersection"||gxtEl.ident==="composition"){gxtEl.name=""}else{gxtEl.name=this.gEBTN(Data,"name")}gxtEl.id=this.gEBTN(Data,"id");return gxtEl},visualProperties:function(gxtEl,Data){gxtEl.visible=JXG.str2Bool(this.gEBTN(Data,"visible"));gxtEl.trace=JXG.str2Bool(this.gEBTN(Data,"trace"));return gxtEl},transformProperties:function(gxtEl,type){var i,facemap=["cross","cross","cross","circle","circle","circle","circle","square","square","square","plus","plus","plus"],sizemap=[2,3,4,1,2,3,4,2,3,4,2,3,4],remove=["color","dash","style","style","ident","colordraft","colorstroke","colorfill","colorlabel","active","area","showinfo","showcoord","fix"];gxtEl.strokeWidth=gxtEl.strokewidth;gxtEl.face=facemap[parseInt(gxtEl.style,10)]||"cross";gxtEl.size=sizemap[parseInt(gxtEl.style,10)]||3;gxtEl.straightFirst=JXG.str2Bool(gxtEl.straightFirst);gxtEl.straightLast=JXG.str2Bool(gxtEl.straightLast);gxtEl.visible=JXG.str2Bool(gxtEl.visible);gxtEl.draft=JXG.str2Bool(gxtEl.draft);gxtEl.trace=JXG.str2Bool(gxtEl.trace);if(type==="point"){gxtEl.fillColor=gxtEl.strokeColor;gxtEl.highlightFillColor=gxtEl.highlightStrokeColor;gxtEl.fillOpacity=gxtEl.strokeOpacity;gxtEl.highlightFillOpacity=gxtEl.highlightStrokeOpacity}if(typeof gxtEl.label==="string"){delete gxtEl.label}gxtEl.label=gxtEl.label||{opacity:gxtEl.labelOpacity};for(i=0;i<remove.length;i++){delete gxtEl[remove[i]]}return gxtEl},readNodes:function(gxtEl,Data,nodeType,prefix){var key,n,arr=this.gEBTN(Data,nodeType,0,false).childNodes;for(n=0;n<arr.length;n++){if(JXG.exists(arr[n].firstChild)){if(JXG.exists(prefix)){key=prefix+JXG.capitalize(arr[n].nodeName)}else{key=arr[n].nodeName}gxtEl[key]=arr[n].firstChild.data}}return gxtEl},subtreeToString:function(root){try{return(new XMLSerializer).serializeToString(root)}catch(e){return root.xml}},readImage:function(node){var pic="",nod=node;if(JXG.exists(nod)){pic=nod.data;while(JXG.exists(nod.nextSibling)){nod=nod.nextSibling;pic+=nod.data}}return pic},parseImage:function(board,fileNode,level,x,y,w,h,el){var tag,id,picStr,tmpImg,im=null;if(fileNode===null){return im}if(JXG.exists(fileNode.getElementsByTagName("src")[0])){tag="src"}else if(JXG.exists(fileNode.getElementsByTagName("image")[0])&&JXG.exists(this.gEBTN(fileNode,"image"))){tag="image"}else{return im}picStr=this.readImage(this.gEBTN(fileNode,tag,0,false).firstChild);if(picStr!==""){picStr="data:image/png;base64,"+picStr;if(tag==="src"){x=this.gEBTN(fileNode,"x");y=this.gEBTN(fileNode,"y");w=this.gEBTN(fileNode,"width");h=this.gEBTN(fileNode,"height");im=board.create("image",[picStr,[x,y],[w,h]],{anchor:el,layer:level});return im}tmpImg=new Image;tmpImg.src=picStr;id=el.id+"_image";tmpImg.onload=function(){var xf,yf,wf,hf,im,tRot,wOrg=this.width,hOrg=this.height;if(el.elementClass===JXG.OBJECT_CLASS_LINE){xf=function(){return el.point1.X()};wf=function(){return el.point1.Dist(el.point2)};hf=function(){return wf()*hOrg/wOrg};yf=function(){return el.point1.Y()-hf()*.5};im=board.create("image",[picStr,[xf,yf],[wf,hf]],{layer:level,id:id,anchor:el});tRot=board.create("transform",[function(){return Math.atan2(el.point2.Y()-el.point1.Y(),el.point2.X()-el.point1.X())},el.point1],{type:"rotate"});tRot.bindTo(im);el.image=im}else if(el.elementClass===JXG.OBJECT_CLASS_POINT){wf=function(){return wOrg/board.unitX};hf=function(){return hOrg/board.unitY};xf=function(){return el.X()-wf()*.5};yf=function(){return el.Y()-hf()*.5};im=board.create("image",[picStr,[xf,yf],[wf,hf]],{layer:level,id:id,anchor:el});board.renderer.display(el.label,false);el.image=im}else if(el.elementClass===JXG.OBJECT_CLASS_CIRCLE){wf=function(){return 2*el.Radius()};hf=function(){return wf()*hOrg/wOrg};xf=function(){return el.center.X()-wf()*.5};yf=function(){return el.center.Y()-hf()*.5};im=board.create("image",[picStr,[xf,yf],[wf,hf]],{layer:level,id:id,anchor:el});el.image=im}else{im=board.create("image",[picStr,[x,y],[w,h]],{layer:level,id:id,anchor:el});el.image=im}};return im}},readConditions:function(node){var i,s,ob,conditions="";if(JXG.exists(node)){for(i=0;i<node.getElementsByTagName("data").length;i++){ob=node.getElementsByTagName("data")[i];s=this.subtreeToString(ob);conditions+=s}}return conditions},readViewPort:function(node){var no,arr=[];no=this.gEBTN(node,"viewport",0,false);if(no){arr[0]=parseFloat(this.gEBTN(no,"left"));arr[1]=parseFloat(this.gEBTN(no,"top"));arr[2]=parseFloat(this.gEBTN(no,"right"));arr[3]=parseFloat(this.gEBTN(no,"bottom"));return arr}return[]},printDebugMessage:function(outputEl,gxtEl,nodetyp,success){JXG.debug("* "+success+": "+nodetyp+" "+gxtEl.name+" "+gxtEl.id)},readNode:function(elChildNodes,s,board){var dataVertex,i,l,x,c,numberDefEls,el,p,inter,rgbo,tmp,v,Data,xmlNode,gxtEl={};Data=elChildNodes[s];gxtEl=this.defProperties(gxtEl,Data);if(!JXG.exists(gxtEl)){return}this.printDebugMessage("debug",gxtEl,Data.nodeName.toLowerCase(),"READ:");switch(Data.nodeName.toLowerCase()){case"point":gxtEl.strokewidth=1;gxtEl=this.colorProperties(gxtEl,Data);gxtEl=this.visualProperties(gxtEl,Data);gxtEl=this.firstLevelProperties(gxtEl,Data);gxtEl=this.readNodes(gxtEl,Data,"data");gxtEl.fixed=JXG.str2Bool(this.gEBTN(Data,"fix"));gxtEl=this.transformProperties(gxtEl,"point");p=board.create("point",[parseFloat(gxtEl.x),parseFloat(gxtEl.y)],gxtEl);v=function(){return p.visProp.visible};el=this.parseImage(board,Data,board.options.layer.image,0,0,0,0,p);this.printDebugMessage("debug",gxtEl,Data.nodeName,"OK");break;case"line":gxtEl=this.colorProperties(gxtEl,Data);gxtEl=this.visualProperties(gxtEl,Data);gxtEl=this.firstLevelProperties(gxtEl,Data);gxtEl=this.readNodes(gxtEl,Data,"data");gxtEl=this.readNodes(gxtEl,Data,"straight","straight");gxtEl=this.transformProperties(gxtEl);gxtEl.first=this.changeOriginIds(board,gxtEl.first);gxtEl.last=this.changeOriginIds(board,gxtEl.last);l=board.create("line",[gxtEl.first,gxtEl.last],gxtEl);this.parseImage(board,Data,board.options.layer.image,0,0,0,0,l);this.printDebugMessage("debug",gxtEl,Data.nodeName,"OK");break;case"circle":gxtEl=this.colorProperties(gxtEl,Data);gxtEl=this.visualProperties(gxtEl,Data);gxtEl=this.firstLevelProperties(gxtEl,Data);tmp=this.gEBTN(Data,"data",0,false);gxtEl.center=this.changeOriginIds(board,this.gEBTN(tmp,"midpoint"));if(tmp.getElementsByTagName("radius").length>0){gxtEl.radius=this.changeOriginIds(board,this.gEBTN(tmp,"radius"))}else if(tmp.getElementsByTagName("radiusvalue").length>0){gxtEl.radius=this.gEBTN(tmp,"radiusvalue")}gxtEl=this.transformProperties(gxtEl);c=board.create("circle",[gxtEl.center,gxtEl.radius],gxtEl);this.parseImage(board,Data,board.options.layer.image,0,0,0,0,c);this.printDebugMessage("debug",gxtEl,Data.nodeName,"OK");break;case"slider":gxtEl.strokewidth=1;gxtEl=this.colorProperties(gxtEl,Data);gxtEl=this.visualProperties(gxtEl,Data);gxtEl=this.firstLevelProperties(gxtEl,Data);gxtEl=this.readNodes(gxtEl,Data,"data");gxtEl.fixed=JXG.str2Bool(this.gEBTN(Data,"fix"));gxtEl=this.readNodes(gxtEl,Data,"animate","animate");gxtEl=this.transformProperties(gxtEl,"point");try{gxtEl.parent=this.changeOriginIds(board,gxtEl.parent);gxtEl.isGeonext=true;p=board.create("glider",[parseFloat(gxtEl.x),parseFloat(gxtEl.y),gxtEl.parent],gxtEl);p.onPolygon=JXG.exists(gxtEl.onpolygon)&&JXG.str2Bool(gxtEl.onpolygon);this.parseImage(board,Data,board.options.layer.point,0,0,0,0,p);this.printDebugMessage("debug",gxtEl,Data.nodeName,"OK")}catch(e){JXG.debug("* Err: Slider "+gxtEl.name+" "+gxtEl.id+": "+gxtEl.parent)}break;case"cas":gxtEl=this.colorProperties(gxtEl,Data);gxtEl=this.visualProperties(gxtEl,Data);gxtEl=this.firstLevelProperties(gxtEl,Data);gxtEl.fixed=JXG.str2Bool(Data.getElementsByTagName("fix")[0].firstChild.data);gxtEl=this.readNodes(gxtEl,Data,"data");gxtEl=this.transformProperties(gxtEl,"point");p=board.create("point",[gxtEl.x,gxtEl.y],gxtEl);this.parseImage(board,Data,board.options.layer.point,0,0,0,0,p);this.printDebugMessage("debug",gxtEl,Data.nodeName,"OK");break;case"intersection":gxtEl.strokewidth=1;gxtEl=this.readNodes(gxtEl,Data,"data");xmlNode=Data.getElementsByTagName("first")[1];gxtEl.outFirst={};gxtEl.outFirst=this.colorProperties(gxtEl.outFirst,xmlNode);gxtEl.outFirst=this.visualProperties(gxtEl.outFirst,xmlNode);gxtEl.outFirst=this.firstLevelProperties(gxtEl.outFirst,xmlNode);gxtEl.outFirst.fixed=JXG.str2Bool(xmlNode.getElementsByTagName("fix")[0].firstChild.data);gxtEl.outFirst=this.transformProperties(gxtEl.outFirst,"point");gxtEl.first=this.changeOriginIds(board,gxtEl.first);gxtEl.last=this.changeOriginIds(board,gxtEl.last);if(board.select(gxtEl.first).elementClass===JXG.OBJECT_CLASS_LINE&&board.select(gxtEl.last).elementClass===JXG.OBJECT_CLASS_LINE){inter=board.create("intersection",[board.objects[gxtEl.first],board.objects[gxtEl.last],0],gxtEl.outFirst);if(gxtEl.outFirst.visible==="false"){inter.hideElement()}}else{xmlNode=Data.getElementsByTagName("last")[1];if(JXG.exists(xmlNode)){gxtEl.outLast={};gxtEl.outLast=this.colorProperties(gxtEl.outLast,xmlNode);gxtEl.outLast=this.visualProperties(gxtEl.outLast,xmlNode);gxtEl.outLast=this.firstLevelProperties(gxtEl.outLast,xmlNode);gxtEl.outLast.fixed=JXG.str2Bool(xmlNode.getElementsByTagName("fix")[0].firstChild.data);gxtEl.outLast=this.transformProperties(gxtEl.outLast,"point");inter=board.create("intersection",[board.objects[gxtEl.first],board.objects[gxtEl.last],0],gxtEl.outFirst);inter=board.create("intersection",[board.objects[gxtEl.first],board.objects[gxtEl.last],1],gxtEl.outLast)}}this.printDebugMessage("debug",gxtEl,Data.nodeName,"OK");break;case"composition":gxtEl=this.readNodes(gxtEl,Data,"data");gxtEl=this.firstLevelProperties(gxtEl,Data);gxtEl.defEl=[];numberDefEls=0;xmlNode=Data.getElementsByTagName("data")[0].getElementsByTagName("input");for(i=0;i<xmlNode.length;i++){gxtEl.defEl[i]=xmlNode[i].firstChild.data;numberDefEls=i+1}xmlNode=Data.getElementsByTagName("output")[0];gxtEl.out={};gxtEl.out=this.colorProperties(gxtEl.out,xmlNode);gxtEl.out=this.visualProperties(gxtEl.out,xmlNode);gxtEl.out=this.firstLevelProperties(gxtEl.out,xmlNode);gxtEl.out=this.transformProperties(gxtEl.out);gxtEl.defEl[0]=this.changeOriginIds(board,gxtEl.defEl[0]);gxtEl.defEl[1]=this.changeOriginIds(board,gxtEl.defEl[1]);gxtEl.defEl[2]=this.changeOriginIds(board,gxtEl.defEl[2]);switch(gxtEl.type){case"210070":gxtEl.out.fixed=this.gEBTN(xmlNode,"fix");xmlNode=Data.getElementsByTagName("output")[1];gxtEl.outPoint={};gxtEl.outPoint=this.defProperties(gxtEl.outPoint,xmlNode);gxtEl.outPoint=this.colorProperties(gxtEl.outPoint,xmlNode);gxtEl.outPoint=this.visualProperties(gxtEl.outPoint,xmlNode);gxtEl.outPoint=this.firstLevelProperties(gxtEl.outPoint,xmlNode);gxtEl.outPoint=this.transformProperties(gxtEl.outPoint);p=board.create("parallelpoint",[gxtEl.defEl[1],gxtEl.defEl[0]],gxtEl.outPoint);gxtEl.out.firstArrow=false;gxtEl.out.lastArrow=true;el=board.create("segment",[gxtEl.defEl[0],p],gxtEl.out);el.parallelpoint=p;break;case"210080":gxtEl.out.straightFirst=false;board.create("bisector",[gxtEl.defEl[0],gxtEl.defEl[1],gxtEl.defEl[2]],gxtEl.out);break;case"210090":xmlNode=Data.getElementsByTagName("output")[1];gxtEl.outCircle={};gxtEl.outCircle=this.defProperties(gxtEl.outCircle,xmlNode);gxtEl.outCircle=this.colorProperties(gxtEl.outCircle,xmlNode);gxtEl.outCircle=this.visualProperties(gxtEl.outCircle,xmlNode);gxtEl.outCircle=this.firstLevelProperties(gxtEl.outCircle,xmlNode);gxtEl.outCircle=this.transformProperties(gxtEl.outCircle);gxtEl.outCircle.point=gxtEl.out;board.create("circumcircle",[gxtEl.defEl[0],gxtEl.defEl[1],gxtEl.defEl[2]],gxtEl.outCircle);break;case"210100":board.create("circumcenter",[gxtEl.defEl[0],gxtEl.defEl[1],gxtEl.defEl[2]],gxtEl.out);break;case"210110":board.create("midpoint",gxtEl.defEl.slice(0,numberDefEls),gxtEl.out);break;case"210120":board.create("reflection",[gxtEl.defEl[1],gxtEl.defEl[0]],gxtEl.out);break;case"210125":board.create("mirrorpoint",[gxtEl.defEl[0],gxtEl.defEl[1]],gxtEl.out);break;case"210130":board.create("perpendicularsegment",[gxtEl.defEl[0],gxtEl.defEl[1]],gxtEl.out);break;case"210140":p=board.create("parallelpoint",[gxtEl.defEl[1],gxtEl.defEl[0]],{withLabel:false,visible:false,name:"",fixed:true});el=board.create("line",[gxtEl.defEl[0],p],gxtEl.out);el.parallelpoint=p;break;case"210150":board.create("parallelpoint",gxtEl.defEl.slice(0,numberDefEls),gxtEl.out);break;case"210160":gxtEl.out.fixed=this.gEBTN(xmlNode,"fix");xmlNode=Data.getElementsByTagName("output")[1];gxtEl.outLine={};gxtEl.outLine=this.defProperties(gxtEl.outLine,xmlNode);gxtEl.outLine=this.colorProperties(gxtEl.outLine,xmlNode);gxtEl.outLine=this.visualProperties(gxtEl.outLine,xmlNode);gxtEl.outLine=this.firstLevelProperties(gxtEl.outLine,xmlNode);gxtEl.outLine=this.readNodes(gxtEl.outLine,xmlNode,"straight","straight");gxtEl.outLine=this.transformProperties(gxtEl.outLine);gxtEl.outLine.point=gxtEl.out;board.create("perpendicularsegment",[gxtEl.defEl[1],gxtEl.defEl[0]],gxtEl.outLine);break;case"210170":board.create("perpendicularpoint",[gxtEl.defEl[1],gxtEl.defEl[0]],gxtEl.out);break;case"210180":throw new Error("JSXGraph: Element ROTATION not yet implemented.");case"210190":gxtEl.out=this.defProperties(gxtEl.out,xmlNode);gxtEl.out.firstArrow=JXG.str2Bool(this.gEBTN(xmlNode,"firstarrow"));gxtEl.out.lastArrow=JXG.str2Bool(this.gEBTN(xmlNode,"lastarrow"));xmlNode=[];c=[];for(i=0;i<4;i++){xmlNode[i]=Data.getElementsByTagName("output")[i];gxtEl.out={};gxtEl.out=this.defProperties(gxtEl.out,xmlNode[i]);gxtEl.out=this.colorProperties(gxtEl.out,xmlNode[i]);gxtEl.out=this.visualProperties(gxtEl.out,xmlNode[i]);gxtEl.out=this.firstLevelProperties(gxtEl.out,xmlNode[i]);gxtEl.out=this.transformProperties(gxtEl.out);c[i]=gxtEl.out}el=board.create("sector",gxtEl.defEl,c[0]);p=board.create("point",[function(){var p1=board.select(gxtEl.defEl[1]),p2=board.select(gxtEl.defEl[2]);return p1.X()+(p2.X()-p1.X())*el.Radius/p1.Dist(p2)},function(){var p1=board.select(gxtEl.defEl[1]),p2=board.select(gxtEl.defEl[2]);return p1.Y()+(p2.Y()-p1.Y())*el.Radius/p1.Dist(p2)}],c[1]);el=board.create("segment",[gxtEl.defEl[0],gxtEl.defEl[1]],c[2]);el=board.create("segment",[gxtEl.defEl[1],p],c[3]);break;default:throw new Error("JSXGraph: GEONExT -- element "+gxtEl.type+" not implemented.")}this.printDebugMessage("debug",gxtEl,Data.nodeName,"OK");break;case"polygon":gxtEl=this.colorProperties(gxtEl,Data);gxtEl=this.firstLevelProperties(gxtEl,Data);dataVertex=[];for(i=0;i<Data.getElementsByTagName("data")[0].getElementsByTagName("vertex").length-1;i++){dataVertex[i]=Data.getElementsByTagName("data")[0].getElementsByTagName("vertex")[i].firstChild.data;dataVertex[i]=this.changeOriginIds(board,dataVertex[i])}gxtEl.border=[];gxtEl.borders={ids:[],names:[]};for(i=0;i<Data.getElementsByTagName("border").length;i++){gxtEl.border[i]={};xmlNode=Data.getElementsByTagName("border")[i];gxtEl.border[i].id=xmlNode.getElementsByTagName("id")[0].firstChild.data;gxtEl.borders.ids.push(gxtEl.border[i].id);gxtEl.border[i].name=xmlNode.getElementsByTagName("name")[0].firstChild.data;gxtEl.borders.names.push(gxtEl.border[i].name);gxtEl.border[i].straightFirst=JXG.str2Bool(xmlNode.getElementsByTagName("straight")[0].getElementsByTagName("first")[0].firstChild.data);gxtEl.border[i].straightLast=JXG.str2Bool(xmlNode.getElementsByTagName("straight")[0].getElementsByTagName("last")[0].firstChild.data);try{gxtEl.border[i].strokeWidth=xmlNode.getElementsByTagName("strokewidth")[0].firstChild.data}catch(ex){gxtEl.border[i].strokeWidth=xmlNode.getElementsByTagName("width")[0].firstChild.data}try{gxtEl.border[i].dash=JXG.str2Bool(xmlNode.getElementsByTagName("dash")[0].firstChild.data)}catch(exc){}gxtEl.border[i].visible=JXG.str2Bool(xmlNode.getElementsByTagName("visible")[0].firstChild.data);gxtEl.border[i].draft=JXG.str2Bool(xmlNode.getElementsByTagName("draft")[0].firstChild.data);gxtEl.border[i].trace=JXG.str2Bool(xmlNode.getElementsByTagName("trace")[0].firstChild.data);xmlNode=Data.getElementsByTagName("border")[i].getElementsByTagName("color")[0];rgbo=JXG.rgba2rgbo(xmlNode.getElementsByTagName("stroke")[0].firstChild.data);gxtEl.border[i].strokeColor=rgbo[0];gxtEl.border[i].strokeOpacity=rgbo[1];rgbo=JXG.rgba2rgbo(xmlNode.getElementsByTagName("lighting")[0].firstChild.data);gxtEl.border[i].highlightStrokeColor=rgbo[0];gxtEl.border[i].highlightStrokeOpacity=rgbo[1];rgbo=JXG.rgba2rgbo(xmlNode.getElementsByTagName("fill")[0].firstChild.data);gxtEl.border[i].fillColor=rgbo[0];gxtEl.border[i].fillOpacity=rgbo[1];gxtEl.border[i].highlightFillColor=gxtEl.border[i].fillColor;gxtEl.border[i].highlightFillOpacity=gxtEl.border[i].fillOpacity;gxtEl.border[i].labelColor=xmlNode.getElementsByTagName("label")[0].firstChild.data;gxtEl.border[i].colorDraft=xmlNode.getElementsByTagName("draft")[0].firstChild.data}gxtEl=this.transformProperties(gxtEl);p=board.create("polygon",dataVertex,gxtEl);for(i=0;i<p.borders.length;i++){p.borders[i].setAttribute(gxtEl.border[i])}this.printDebugMessage("debug",gxtEl,Data.nodeName,"OK");break;case"graph":gxtEl=this.colorProperties(gxtEl,Data);gxtEl=this.firstLevelProperties(gxtEl,Data);gxtEl.funct=Data.getElementsByTagName("data")[0].getElementsByTagName("function")[0].firstChild.data;gxtEl.funct=board.jc.snippet(gxtEl.funct,true,"x",true);c=board.create("plot",[gxtEl.funct],{id:gxtEl.id,name:gxtEl.name,strokeColor:gxtEl.strokeColor,strokeWidth:gxtEl.strokeWidth,fillColor:"none",highlightFillColor:"none",highlightStrokeColor:gxtEl.highlightStrokeColor,visible:JXG.str2Bool(gxtEl.visible)});this.printDebugMessage("debug",gxtEl,Data.nodeName,"OK");break;case"arrow":gxtEl=this.colorProperties(gxtEl,Data);gxtEl=this.visualProperties(gxtEl,Data);gxtEl=this.firstLevelProperties(gxtEl,Data);gxtEl=this.readNodes(gxtEl,Data,"data");gxtEl=this.readNodes(gxtEl,Data,"straight","straight");gxtEl=this.transformProperties(gxtEl);gxtEl.first=this.changeOriginIds(board,gxtEl.first);gxtEl.last=this.changeOriginIds(board,gxtEl.last);l=board.create("arrow",[gxtEl.first,gxtEl.last],gxtEl);this.printDebugMessage("debug",l,Data.nodeName,"OK");break;case"arc":gxtEl=this.colorProperties(gxtEl,Data);gxtEl=this.visualProperties(gxtEl,Data);gxtEl=this.firstLevelProperties(gxtEl,Data);gxtEl=this.readNodes(gxtEl,Data,"data");gxtEl.firstArrow=JXG.str2Bool(Data.getElementsByTagName("lastarrow")[0].firstChild.data);gxtEl.lastArrow=JXG.str2Bool(Data.getElementsByTagName("firstarrow")[0].firstChild.data);gxtEl=this.transformProperties(gxtEl);gxtEl.center=this.changeOriginIds(board,gxtEl.midpoint);gxtEl.angle=this.changeOriginIds(board,gxtEl.angle);gxtEl.radius=this.changeOriginIds(board,gxtEl.radius);c=board.create("arc",[gxtEl.center,gxtEl.radius,gxtEl.angle],gxtEl);this.printDebugMessage("debug",c,Data.nodeName,"OK");break;case"angle":gxtEl=this.colorProperties(gxtEl,Data);gxtEl=this.visualProperties(gxtEl,Data);gxtEl=this.firstLevelProperties(gxtEl,Data);gxtEl=this.readNodes(gxtEl,Data,"data");gxtEl=this.transformProperties(gxtEl);gxtEl.radius*=1;c=board.create("angle",[gxtEl.first,gxtEl.middle,gxtEl.last],gxtEl);this.printDebugMessage("debug",gxtEl,Data.nodeName,"OK");break;case"text":if(gxtEl.id.match(/oldVersion/)){break}gxtEl=this.colorProperties(gxtEl,Data);gxtEl=this.visualProperties(gxtEl,Data);gxtEl=this.firstLevelProperties(gxtEl,Data);gxtEl=this.readNodes(gxtEl,Data,"data");try{gxtEl.mpStr=this.subtreeToString(Data.getElementsByTagName("data")[0].getElementsByTagName("mp")[0]);gxtEl.mpStr=gxtEl.mpStr.replace(/<\/?mp>/g,"")}catch(ex1){gxtEl.mpStr=this.subtreeToString(Data.getElementsByTagName("data")[0].getElementsByTagName("content")[0]);gxtEl.mpStr=gxtEl.mpStr.replace(/<\/?content>/g,"")}gxtEl.fixed=false;try{if(Data.getElementsByTagName("data")[0].getElementsByTagName("parent")[0].firstChild){gxtEl.parent=Data.getElementsByTagName("data")[0].getElementsByTagName("parent")[0].firstChild.data;gxtEl.fixed=true}}catch(ex2){}try{gxtEl.condition=Data.getElementsByTagName("condition")[0].firstChild.data}catch(ex3){gxtEl.condition=""}gxtEl.content=Data.getElementsByTagName("content")[0].firstChild.data;try{gxtEl.fixed=Data.getElementsByTagName("fix")[0].firstChild.data}catch(ex4){gxtEl.fixed=false}try{gxtEl.autodigits=Data.getElementsByTagName("digits")[0].firstChild.data}catch(ex5){gxtEl.autodigits=2}gxtEl.parent=this.changeOriginIds(board,gxtEl.parent);c=board.create("text",[parseFloat(gxtEl.x),parseFloat(gxtEl.y),gxtEl.mpStr],{anchor:gxtEl.parent,id:gxtEl.id,name:gxtEl.name,digits:gxtEl.autodigits,isLabel:false,strokeColor:gxtEl.colorLabel,fixed:gxtEl.fixed,visible:JXG.str2Bool(gxtEl.visible)});break;case"parametercurve":gxtEl=this.colorProperties(gxtEl,Data);gxtEl=this.visualProperties(gxtEl,Data);gxtEl=this.firstLevelProperties(gxtEl,Data);gxtEl=this.transformProperties(gxtEl);gxtEl.functionx=Data.getElementsByTagName("functionx")[0].firstChild.data;gxtEl.functiony=Data.getElementsByTagName("functiony")[0].firstChild.data;gxtEl.min=Data.getElementsByTagName("min")[0].firstChild.data;gxtEl.max=Data.getElementsByTagName("max")[0].firstChild.data;gxtEl.fillColor="none";gxtEl.highlightFillColor="none";board.create("curve",[board.jc.snippet(gxtEl.functionx,true,"t",true),board.jc.snippet(gxtEl.functiony,true,"t",true),board.jc.snippet(gxtEl.min,true,"",true),board.jc.snippet(gxtEl.max,true,"",true)],gxtEl);this.printDebugMessage("debug",gxtEl,Data.nodeName,"OK");break;case"tracecurve":gxtEl.tracepoint=Data.getElementsByTagName("tracepoint")[0].firstChild.data;gxtEl.traceslider=Data.getElementsByTagName("traceslider")[0].firstChild.data;board.create("tracecurve",[gxtEl.traceslider,gxtEl.tracepoint],gxtEl);this.printDebugMessage("debug",gxtEl,Data.nodeName,"OK");break;case"group":gxtEl=this.colorProperties(gxtEl,Data);gxtEl=this.firstLevelProperties(gxtEl,Data);gxtEl.members=[];for(i=0;i<Data.getElementsByTagName("data")[0].getElementsByTagName("member").length;i++){gxtEl.members[i]=Data.getElementsByTagName("data")[0].getElementsByTagName("member")[i].firstChild.data;gxtEl.members[i]=this.changeOriginIds(board,gxtEl.members[i])}c=new JXG.Group(board,gxtEl.id,gxtEl.name,gxtEl.members);this.printDebugMessage("debug",gxtEl,Data.nodeName,"OK");break;default:JXG.debug("* Err: "+Data.nodeName+" not yet implemented")}},read:function(){var xmlNode,elChildNodes,s,boardData,conditions,tmp,tree=this.tree,board=this.board,strTrue="true";board.options.layer.sector=board.options.layer.angle;board.options.layer.circle=board.options.layer.angle;board.options.line.label.position="top";boardData=this.gEBTN(tree,"board",0,false);conditions=this.readConditions(boardData.getElementsByTagName("conditions")[0]);s=this.gEBTN(boardData,"background",0,false);s=this.gEBTN(s,"color",0,true);tmp=JXG.rgba2rgbo(s);s=JXG.rgbParser(tmp[0]);board.containerObj.style.backgroundColor="rgba("+s[0]+", "+s[1]+", "+s[2]+", "+tmp[1]+")";if(board.attr.takeSizeFromFile){board.resizeContainer(this.gEBTN(boardData,"width"),this.gEBTN(boardData,"height"))}xmlNode=this.gEBTN(boardData,"coordinates",0,false);tmp=this.readViewPort(xmlNode);if(tmp.length===4){board.setBoundingBox(tmp,true)}else{tmp=this.gEBTN(xmlNode,"zoom",0,false);board.zoomX=parseFloat(this.gEBTN(tmp,"x"));board.zoomY=parseFloat(this.gEBTN(tmp,"y"));tmp=this.gEBTN(xmlNode,"origin",0,false);board.origin={usrCoords:[1,0,0],scrCoords:[1,parseFloat(this.gEBTN(tmp,"x"))*board.zoomX,parseFloat(this.gEBTN(tmp,"y"))*board.zoomY]};tmp=this.gEBTN(xmlNode,"unit",0,false);board.unitX=parseFloat(this.gEBTN(tmp,"x"))*board.zoomX;board.unitY=parseFloat(this.gEBTN(tmp,"y"))*board.zoomY}if(board.attr.takeSizeFromFile){board.resizeContainer(this.gEBTN(boardData,"width"),this.gEBTN(boardData,"height"))}if(parseFloat(board.options.text.fontSize)<0){board.options.text.fontSize=12}board.geonextCompatibilityMode=true;delete JXG.boards[board.id];board.id=this.gEBTN(boardData,"id");JXG.boards[board.id]=board;board.initGeonextBoard();board.renderer.enhancedRendering=true;this.parseImage(board,this.gEBTN(boardData,"file",0,false),board.options.layer.image);board.options.point.snapToGrid=this.gEBTN(this.gEBTN(boardData,"coordinates",0,false),"snap")===strTrue;if(board.options.point.snapToGrid&&this.gEBTN(this.gEBTN(boardData,"grid",1,false),"pointsnap")===strTrue){board.options.point.snapToGrid=false;board.options.point.snapToPoints=true;board.options.point.attractorDistance=.5}xmlNode=this.gEBTN(boardData,"grid",1,false);tmp=this.gEBTN(xmlNode,"x");if(tmp){board.options.grid.gridX=1/parseFloat(tmp);board.options.point.snapSizeX=1/parseFloat(tmp)}tmp=this.gEBTN(xmlNode,"y");if(tmp){board.options.grid.gridY=1/parseFloat(tmp);board.options.point.snapSizeY=1/parseFloat(tmp)}board.options.grid.gridDash=JXG.str2Bool(this.gEBTN(xmlNode,"dash"));tmp=JXG.rgba2rgbo(this.gEBTN(xmlNode,"color"));board.options.grid.gridColor=tmp[0];board.options.grid.gridOpacity=tmp[1];xmlNode=this.gEBTN(boardData,"coordinates",0,false);if(this.gEBTN(xmlNode,"grid")===strTrue){board.create("grid",[])}if(this.gEBTN(xmlNode,"coord")===strTrue){board.options.axis.ticks.majorHeight=10;board.options.axis.ticks.minorHeight=4;board.create("axis",[[0,0],[1,0]]);board.create("axis",[[0,0],[0,1]])}tmp=this.gEBTN(this.gEBTN(boardData,"background",0,false),"color");if(tmp.length===8){tmp="#"+tmp}board.containerObj.style.backgroundColor=JXG.rgba2rgbo(tmp)[0];elChildNodes=tree.getElementsByTagName("elements")[0].childNodes;for(s=0;s<elChildNodes.length;s++){this.readNode(elChildNodes,s,board)}board.addConditions(conditions)},decodeString:function(str){var unz;if(str.indexOf("<GEONEXT>")<0){unz=new JXG.Util.Unzip(JXG.Util.Base64.decodeAsArray(str)).unzip();if(unz===""){return str}return unz}return str},prepareString:function(fileStr){try{if(fileStr.indexOf("GEONEXT")<0){fileStr=this.decodeString(fileStr)[0][0]}fileStr=this.fixXML(fileStr)}catch(exc2){fileStr=""}return fileStr},fixXML:function(str){var arr=["active","angle","animate","animated","arc","area","arrow","author","autodigits","axis","back","background","board","border","bottom","buttonsize","cas","circle","color","comment","composition","condition","conditions","content","continuous","control","coord","coordinates","cross","cs","dash","data","description","digits","direction","draft","editable","elements","event","file","fill","first","firstarrow","fix","fontsize","free","full","function","functionx","functiony","GEONEXT","graph","grid","group","height","id","image","info","information","input","intersection","item","jsf","label","last","lastarrow","left","lefttoolbar","lighting","line","loop","max","maximized","member","middle","midpoint","min","modifier","modus","mp","mpx","multi","name","onpolygon","order","origin","output","overline","parametercurve","parent","point","pointsnap","polygon","position","radius","radiusnum","radiusvalue","right","section","selectedlefttoolbar","showconstruction","showcoord","showinfo","showunit","showx","showy","size","slider","snap","speed","src","start","stop","straight","stroke","strokewidth","style","term","text","top","trace","tracecurve","tracepoint","traceslider","type","unit","value","VERSION","vertex","viewport","visible","width","wot","x","xooy","xval","y","yval","zoom"],list=arr.join("|"),regex="<(/?("+list+"))>",expr=new RegExp(regex,"g");str=JXG.escapeHTML(str);str=str.replace(expr,"<$1>");str=str.replace(/(<content>.*)<arc>(.*<\/content>)/g,"$1<arc>$2");str=str.replace(/(<mp>.*)<arc>(.*<\/mpx>)/g,"$1<arc>$2");str=str.replace(/(<mpx>.*)<arc>(.*<\/mpx>)/g,"$1<arc>$2");return str}});JXG.registerReader(JXG.GeonextReader,["gxt","geonext"])})();
|
|
61
|
+
!function(){"use strict";JXG.GeonextReader=function(e,t){var i;this.board=e,i=this.prepareString(t),this.tree=JXG.XML.parse(i)},JXG.extend(JXG.GeonextReader.prototype,{changeOriginIds:function(e,t){return"gOOe0"===t||"gXOe0"===t||"gYOe0"===t||"gXLe0"===t||"gYLe0"===t?e.id+t:t},gEBTN:function(e,t,i,r){var s=[];return JXG.exists(e||!e.getElementsByTagName)?(JXG.exists(r)||(r=!0),i=i||0,e.getElementsByTagName&&(s=e.getElementsByTagName(t)),s.length>0&&(s=s[i],r&&s.firstChild&&(s=s.firstChild.data)),s):e},colorProperties:function(e,t){var i,r=this.gEBTN(t,"color",0,!1);return i=JXG.rgba2rgbo(this.gEBTN(r,"stroke")),e.strokeColor=i[0],e.strokeOpacity=i[1],i=JXG.rgba2rgbo(this.gEBTN(r,"lighting")),e.highlightStrokeColor=i[0],e.highlightStrokeOpacity=i[1],i=JXG.rgba2rgbo(this.gEBTN(r,"fill")),e.fillColor=i[0],e.fillOpacity=i[1],e.highlightFillColor=e.fillColor,e.highlightFillOpacity=e.fillOpacity,i=JXG.rgba2rgbo(this.gEBTN(r,"label")),e.labelColor=i[0],e.withLabel=i[1]>0,e.labelOpacity=i[1],e.colorDraft=JXG.rgba2rgbo(this.gEBTN(r,"draft"))[0],e.colorStroke=e.strokeColor,e.colorFill=e.fillColor,e.colorLabel=e.labelColor,e},firstLevelProperties:function(e,t){var i,r,s;if(!JXG.exists(t)||!JXG.exists(t.childNodes))return e;for(s=t.childNodes,i=0;i<s.length;i++)JXG.exists(s[i].firstChild)&&"data"!==s[i].nodeName&&"straight"!==s[i].nodeName&&("width"===(r=s[i].nodeName)&&(r="strokewidth"),e[r]=s[i].firstChild.data);return e},defProperties:function(e,t){return 3===t.nodeType||8===t.nodeType?null:(e.ident=t.nodeName,"text"===e.ident||"intersection"===e.ident||"composition"===e.ident?e.name="":e.name=this.gEBTN(t,"name"),e.id=this.gEBTN(t,"id"),e)},visualProperties:function(e,t){return e.visible=JXG.str2Bool(this.gEBTN(t,"visible")),e.trace=JXG.str2Bool(this.gEBTN(t,"trace")),e},transformProperties:function(e,t){var i,r=["color","dash","style","style","ident","colordraft","colorstroke","colorfill","colorlabel","active","area","showinfo","showcoord","fix"];for(e.strokeWidth=e.strokewidth,e.face=["cross","cross","cross","circle","circle","circle","circle","square","square","square","plus","plus","plus"][parseInt(e.style,10)]||"cross",e.size=[2,3,4,1,2,3,4,2,3,4,2,3,4][parseInt(e.style,10)]||3,e.straightFirst=JXG.str2Bool(e.straightFirst),e.straightLast=JXG.str2Bool(e.straightLast),e.visible=JXG.str2Bool(e.visible),e.draft=JXG.str2Bool(e.draft),e.trace=JXG.str2Bool(e.trace),"point"===t&&(e.fillColor=e.strokeColor,e.highlightFillColor=e.highlightStrokeColor,e.fillOpacity=e.strokeOpacity,e.highlightFillOpacity=e.highlightStrokeOpacity),"string"==typeof e.label&&delete e.label,e.label=e.label||{opacity:e.labelOpacity},i=0;i<r.length;i++)delete e[r[i]];return e},readNodes:function(e,t,i,r){var s,o=this.gEBTN(t,i,0,!1).childNodes;for(s=0;s<o.length;s++)JXG.exists(o[s].firstChild)&&(e[JXG.exists(r)?r+JXG.capitalize(o[s].nodeName):o[s].nodeName]=o[s].firstChild.data);return e},subtreeToString:function(e){try{return(new XMLSerializer).serializeToString(e)}catch(t){return e.xml}},readImage:function(e){var t="",i=e;if(JXG.exists(i))for(t=i.data;JXG.exists(i.nextSibling);)t+=(i=i.nextSibling).data;return t},parseImage:function(e,t,i,r,s,o,a,n){var l,g,d,h,c=null;if(null===t)return c;if(JXG.exists(t.getElementsByTagName("src")[0]))l="src";else{if(!JXG.exists(t.getElementsByTagName("image")[0])||!JXG.exists(this.gEBTN(t,"image")))return c;l="image"}return""!==(d=this.readImage(this.gEBTN(t,l,0,!1).firstChild))?(d="data:image/png;base64,"+d,"src"===l?(r=this.gEBTN(t,"x"),s=this.gEBTN(t,"y"),o=this.gEBTN(t,"width"),a=this.gEBTN(t,"height"),c=e.create("image",[d,[r,s],[o,a]],{anchor:n,layer:i})):((h=new Image).src=d,g=n.id+"_image",h.onload=function(){var t,l,h,c,p,u=this.width,m=this.height;n.elementClass===JXG.OBJECT_CLASS_LINE?(t=function(){return n.point1.X()},h=function(){return n.point1.Dist(n.point2)},c=function(){return h()*m/u},l=function(){return n.point1.Y()-.5*c()},p=e.create("image",[d,[t,l],[h,c]],{layer:i,id:g,anchor:n}),e.create("transform",[function(){return Math.atan2(n.point2.Y()-n.point1.Y(),n.point2.X()-n.point1.X())},n.point1],{type:"rotate"}).bindTo(p),n.image=p):n.elementClass===JXG.OBJECT_CLASS_POINT?(h=function(){return u/e.unitX},c=function(){return m/e.unitY},t=function(){return n.X()-.5*h()},l=function(){return n.Y()-.5*c()},p=e.create("image",[d,[t,l],[h,c]],{layer:i,id:g,anchor:n}),e.renderer.display(n.label,!1),n.image=p):n.elementClass===JXG.OBJECT_CLASS_CIRCLE?(h=function(){return 2*n.Radius()},c=function(){return h()*m/u},t=function(){return n.center.X()-.5*h()},l=function(){return n.center.Y()-.5*c()},p=e.create("image",[d,[t,l],[h,c]],{layer:i,id:g,anchor:n}),n.image=p):(p=e.create("image",[d,[r,s],[o,a]],{layer:i,id:g,anchor:n}),n.image=p)},c)):void 0},readConditions:function(e){var t,i,r="";if(JXG.exists(e))for(t=0;t<e.getElementsByTagName("data").length;t++)i=e.getElementsByTagName("data")[t],r+=this.subtreeToString(i);return r},readViewPort:function(e){var t,i=[];return(t=this.gEBTN(e,"viewport",0,!1))?(i[0]=parseFloat(this.gEBTN(t,"left")),i[1]=parseFloat(this.gEBTN(t,"top")),i[2]=parseFloat(this.gEBTN(t,"right")),i[3]=parseFloat(this.gEBTN(t,"bottom")),i):[]},printDebugMessage:function(e,t,i,r){JXG.debug("* "+r+": "+i+" "+t.name+" "+t.id)},readNode:function(e,t,i){var r,s,o,a,n,l,g,d,h,c,p,u,m={};if(p=e[t],m=this.defProperties(m,p),JXG.exists(m))switch(this.printDebugMessage("debug",m,p.nodeName.toLowerCase(),"READ:"),p.nodeName.toLowerCase()){case"point":m.strokewidth=1,m=this.colorProperties(m,p),m=this.visualProperties(m,p),m=this.firstLevelProperties(m,p),(m=this.readNodes(m,p,"data")).fixed=JXG.str2Bool(this.gEBTN(p,"fix")),m=this.transformProperties(m,"point"),g=i.create("point",[parseFloat(m.x),parseFloat(m.y)],m),function(){return g.visProp.visible},l=this.parseImage(i,p,i.options.layer.image,0,0,0,0,g),this.printDebugMessage("debug",m,p.nodeName,"OK");break;case"line":m=this.colorProperties(m,p),m=this.visualProperties(m,p),m=this.firstLevelProperties(m,p),m=this.readNodes(m,p,"data"),m=this.readNodes(m,p,"straight","straight"),(m=this.transformProperties(m)).first=this.changeOriginIds(i,m.first),m.last=this.changeOriginIds(i,m.last),o=i.create("line",[m.first,m.last],m),this.parseImage(i,p,i.options.layer.image,0,0,0,0,o),this.printDebugMessage("debug",m,p.nodeName,"OK");break;case"circle":m=this.colorProperties(m,p),m=this.visualProperties(m,p),m=this.firstLevelProperties(m,p),c=this.gEBTN(p,"data",0,!1),m.center=this.changeOriginIds(i,this.gEBTN(c,"midpoint")),c.getElementsByTagName("radius").length>0?m.radius=this.changeOriginIds(i,this.gEBTN(c,"radius")):c.getElementsByTagName("radiusvalue").length>0&&(m.radius=this.gEBTN(c,"radiusvalue")),m=this.transformProperties(m),a=i.create("circle",[m.center,m.radius],m),this.parseImage(i,p,i.options.layer.image,0,0,0,0,a),this.printDebugMessage("debug",m,p.nodeName,"OK");break;case"slider":m.strokewidth=1,m=this.colorProperties(m,p),m=this.visualProperties(m,p),m=this.firstLevelProperties(m,p),(m=this.readNodes(m,p,"data")).fixed=JXG.str2Bool(this.gEBTN(p,"fix")),m=this.readNodes(m,p,"animate","animate"),m=this.transformProperties(m,"point");try{m.parent=this.changeOriginIds(i,m.parent),m.isGeonext=!0,(g=i.create("glider",[parseFloat(m.x),parseFloat(m.y),m.parent],m)).onPolygon=JXG.exists(m.onpolygon)&&JXG.str2Bool(m.onpolygon),this.parseImage(i,p,i.options.layer.point,0,0,0,0,g),this.printDebugMessage("debug",m,p.nodeName,"OK")}catch(e){JXG.debug("* Err: Slider "+m.name+" "+m.id+": "+m.parent)}break;case"cas":m=this.colorProperties(m,p),m=this.visualProperties(m,p),(m=this.firstLevelProperties(m,p)).fixed=JXG.str2Bool(p.getElementsByTagName("fix")[0].firstChild.data),m=this.readNodes(m,p,"data"),m=this.transformProperties(m,"point"),g=i.create("point",[m.x,m.y],m),this.parseImage(i,p,i.options.layer.point,0,0,0,0,g),this.printDebugMessage("debug",m,p.nodeName,"OK");break;case"intersection":m.strokewidth=1,m=this.readNodes(m,p,"data"),u=p.getElementsByTagName("first")[1],m.outFirst={},m.outFirst=this.colorProperties(m.outFirst,u),m.outFirst=this.visualProperties(m.outFirst,u),m.outFirst=this.firstLevelProperties(m.outFirst,u),m.outFirst.fixed=JXG.str2Bool(u.getElementsByTagName("fix")[0].firstChild.data),m.outFirst=this.transformProperties(m.outFirst,"point"),m.first=this.changeOriginIds(i,m.first),m.last=this.changeOriginIds(i,m.last),i.select(m.first).elementClass===JXG.OBJECT_CLASS_LINE&&i.select(m.last).elementClass===JXG.OBJECT_CLASS_LINE?(d=i.create("intersection",[i.objects[m.first],i.objects[m.last],0],m.outFirst),"false"===m.outFirst.visible&&d.hideElement()):(u=p.getElementsByTagName("last")[1],JXG.exists(u)&&(m.outLast={},m.outLast=this.colorProperties(m.outLast,u),m.outLast=this.visualProperties(m.outLast,u),m.outLast=this.firstLevelProperties(m.outLast,u),m.outLast.fixed=JXG.str2Bool(u.getElementsByTagName("fix")[0].firstChild.data),m.outLast=this.transformProperties(m.outLast,"point"),d=i.create("intersection",[i.objects[m.first],i.objects[m.last],0],m.outFirst),d=i.create("intersection",[i.objects[m.first],i.objects[m.last],1],m.outLast))),this.printDebugMessage("debug",m,p.nodeName,"OK");break;case"composition":for(m=this.readNodes(m,p,"data"),(m=this.firstLevelProperties(m,p)).defEl=[],n=0,u=p.getElementsByTagName("data")[0].getElementsByTagName("input"),s=0;s<u.length;s++)m.defEl[s]=u[s].firstChild.data,n=s+1;switch(u=p.getElementsByTagName("output")[0],m.out={},m.out=this.colorProperties(m.out,u),m.out=this.visualProperties(m.out,u),m.out=this.firstLevelProperties(m.out,u),m.out=this.transformProperties(m.out),m.defEl[0]=this.changeOriginIds(i,m.defEl[0]),m.defEl[1]=this.changeOriginIds(i,m.defEl[1]),m.defEl[2]=this.changeOriginIds(i,m.defEl[2]),m.type){case"210070":m.out.fixed=this.gEBTN(u,"fix"),u=p.getElementsByTagName("output")[1],m.outPoint={},m.outPoint=this.defProperties(m.outPoint,u),m.outPoint=this.colorProperties(m.outPoint,u),m.outPoint=this.visualProperties(m.outPoint,u),m.outPoint=this.firstLevelProperties(m.outPoint,u),m.outPoint=this.transformProperties(m.outPoint),g=i.create("parallelpoint",[m.defEl[1],m.defEl[0]],m.outPoint),m.out.firstArrow=!1,m.out.lastArrow=!0,(l=i.create("segment",[m.defEl[0],g],m.out)).parallelpoint=g;break;case"210080":m.out.straightFirst=!1,i.create("bisector",[m.defEl[0],m.defEl[1],m.defEl[2]],m.out);break;case"210090":u=p.getElementsByTagName("output")[1],m.outCircle={},m.outCircle=this.defProperties(m.outCircle,u),m.outCircle=this.colorProperties(m.outCircle,u),m.outCircle=this.visualProperties(m.outCircle,u),m.outCircle=this.firstLevelProperties(m.outCircle,u),m.outCircle=this.transformProperties(m.outCircle),m.outCircle.point=m.out,i.create("circumcircle",[m.defEl[0],m.defEl[1],m.defEl[2]],m.outCircle);break;case"210100":i.create("circumcenter",[m.defEl[0],m.defEl[1],m.defEl[2]],m.out);break;case"210110":i.create("midpoint",m.defEl.slice(0,n),m.out);break;case"210120":i.create("reflection",[m.defEl[1],m.defEl[0]],m.out);break;case"210125":i.create("mirrorpoint",[m.defEl[0],m.defEl[1]],m.out);break;case"210130":i.create("perpendicularsegment",[m.defEl[0],m.defEl[1]],m.out);break;case"210140":g=i.create("parallelpoint",[m.defEl[1],m.defEl[0]],{withLabel:!1,visible:!1,name:"",fixed:!0}),(l=i.create("line",[m.defEl[0],g],m.out)).parallelpoint=g;break;case"210150":i.create("parallelpoint",m.defEl.slice(0,n),m.out);break;case"210160":m.out.fixed=this.gEBTN(u,"fix"),u=p.getElementsByTagName("output")[1],m.outLine={},m.outLine=this.defProperties(m.outLine,u),m.outLine=this.colorProperties(m.outLine,u),m.outLine=this.visualProperties(m.outLine,u),m.outLine=this.firstLevelProperties(m.outLine,u),m.outLine=this.readNodes(m.outLine,u,"straight","straight"),m.outLine=this.transformProperties(m.outLine),m.outLine.point=m.out,i.create("perpendicularsegment",[m.defEl[1],m.defEl[0]],m.outLine);break;case"210170":i.create("perpendicularpoint",[m.defEl[1],m.defEl[0]],m.out);break;case"210180":throw new Error("JSXGraph: Element ROTATION not yet implemented.");case"210190":for(m.out=this.defProperties(m.out,u),m.out.firstArrow=JXG.str2Bool(this.gEBTN(u,"firstarrow")),m.out.lastArrow=JXG.str2Bool(this.gEBTN(u,"lastarrow")),u=[],a=[],s=0;s<4;s++)u[s]=p.getElementsByTagName("output")[s],m.out={},m.out=this.defProperties(m.out,u[s]),m.out=this.colorProperties(m.out,u[s]),m.out=this.visualProperties(m.out,u[s]),m.out=this.firstLevelProperties(m.out,u[s]),m.out=this.transformProperties(m.out),a[s]=m.out;l=i.create("sector",m.defEl,a[0]),g=i.create("point",[function(){var e=i.select(m.defEl[1]),t=i.select(m.defEl[2]);return e.X()+(t.X()-e.X())*l.Radius/e.Dist(t)},function(){var e=i.select(m.defEl[1]),t=i.select(m.defEl[2]);return e.Y()+(t.Y()-e.Y())*l.Radius/e.Dist(t)}],a[1]),l=i.create("segment",[m.defEl[0],m.defEl[1]],a[2]),l=i.create("segment",[m.defEl[1],g],a[3]);break;default:throw new Error("JSXGraph: GEONExT -- element "+m.type+" not implemented.")}this.printDebugMessage("debug",m,p.nodeName,"OK");break;case"polygon":for(m=this.colorProperties(m,p),m=this.firstLevelProperties(m,p),r=[],s=0;s<p.getElementsByTagName("data")[0].getElementsByTagName("vertex").length-1;s++)r[s]=p.getElementsByTagName("data")[0].getElementsByTagName("vertex")[s].firstChild.data,r[s]=this.changeOriginIds(i,r[s]);for(m.border=[],m.borders={ids:[],names:[]},s=0;s<p.getElementsByTagName("border").length;s++){m.border[s]={},u=p.getElementsByTagName("border")[s],m.border[s].id=u.getElementsByTagName("id")[0].firstChild.data,m.borders.ids.push(m.border[s].id),m.border[s].name=u.getElementsByTagName("name")[0].firstChild.data,m.borders.names.push(m.border[s].name),m.border[s].straightFirst=JXG.str2Bool(u.getElementsByTagName("straight")[0].getElementsByTagName("first")[0].firstChild.data),m.border[s].straightLast=JXG.str2Bool(u.getElementsByTagName("straight")[0].getElementsByTagName("last")[0].firstChild.data);try{m.border[s].strokeWidth=u.getElementsByTagName("strokewidth")[0].firstChild.data}catch(e){m.border[s].strokeWidth=u.getElementsByTagName("width")[0].firstChild.data}try{m.border[s].dash=JXG.str2Bool(u.getElementsByTagName("dash")[0].firstChild.data)}catch(e){}m.border[s].visible=JXG.str2Bool(u.getElementsByTagName("visible")[0].firstChild.data),m.border[s].draft=JXG.str2Bool(u.getElementsByTagName("draft")[0].firstChild.data),m.border[s].trace=JXG.str2Bool(u.getElementsByTagName("trace")[0].firstChild.data),u=p.getElementsByTagName("border")[s].getElementsByTagName("color")[0],h=JXG.rgba2rgbo(u.getElementsByTagName("stroke")[0].firstChild.data),m.border[s].strokeColor=h[0],m.border[s].strokeOpacity=h[1],h=JXG.rgba2rgbo(u.getElementsByTagName("lighting")[0].firstChild.data),m.border[s].highlightStrokeColor=h[0],m.border[s].highlightStrokeOpacity=h[1],h=JXG.rgba2rgbo(u.getElementsByTagName("fill")[0].firstChild.data),m.border[s].fillColor=h[0],m.border[s].fillOpacity=h[1],m.border[s].highlightFillColor=m.border[s].fillColor,m.border[s].highlightFillOpacity=m.border[s].fillOpacity,m.border[s].labelColor=u.getElementsByTagName("label")[0].firstChild.data,m.border[s].colorDraft=u.getElementsByTagName("draft")[0].firstChild.data}for(m=this.transformProperties(m),g=i.create("polygon",r,m),s=0;s<g.borders.length;s++)g.borders[s].setAttribute(m.border[s]);this.printDebugMessage("debug",m,p.nodeName,"OK");break;case"graph":m=this.colorProperties(m,p),(m=this.firstLevelProperties(m,p)).funct=p.getElementsByTagName("data")[0].getElementsByTagName("function")[0].firstChild.data,m.funct=i.jc.snippet(m.funct,!0,"x",!0),a=i.create("plot",[m.funct],{id:m.id,name:m.name,strokeColor:m.strokeColor,strokeWidth:m.strokeWidth,fillColor:"none",highlightFillColor:"none",highlightStrokeColor:m.highlightStrokeColor,visible:JXG.str2Bool(m.visible)}),this.printDebugMessage("debug",m,p.nodeName,"OK");break;case"arrow":m=this.colorProperties(m,p),m=this.visualProperties(m,p),m=this.firstLevelProperties(m,p),m=this.readNodes(m,p,"data"),m=this.readNodes(m,p,"straight","straight"),(m=this.transformProperties(m)).first=this.changeOriginIds(i,m.first),m.last=this.changeOriginIds(i,m.last),o=i.create("arrow",[m.first,m.last],m),this.printDebugMessage("debug",o,p.nodeName,"OK");break;case"arc":m=this.colorProperties(m,p),m=this.visualProperties(m,p),m=this.firstLevelProperties(m,p),(m=this.readNodes(m,p,"data")).firstArrow=JXG.str2Bool(p.getElementsByTagName("lastarrow")[0].firstChild.data),m.lastArrow=JXG.str2Bool(p.getElementsByTagName("firstarrow")[0].firstChild.data),(m=this.transformProperties(m)).center=this.changeOriginIds(i,m.midpoint),m.angle=this.changeOriginIds(i,m.angle),m.radius=this.changeOriginIds(i,m.radius),a=i.create("arc",[m.center,m.radius,m.angle],m),this.printDebugMessage("debug",a,p.nodeName,"OK");break;case"angle":m=this.colorProperties(m,p),m=this.visualProperties(m,p),m=this.firstLevelProperties(m,p),m=this.readNodes(m,p,"data"),(m=this.transformProperties(m)).radius*=1,a=i.create("angle",[m.first,m.middle,m.last],m),this.printDebugMessage("debug",m,p.nodeName,"OK");break;case"text":if(m.id.match(/oldVersion/))break;m=this.colorProperties(m,p),m=this.visualProperties(m,p),m=this.firstLevelProperties(m,p),m=this.readNodes(m,p,"data");try{m.mpStr=this.subtreeToString(p.getElementsByTagName("data")[0].getElementsByTagName("mp")[0]),m.mpStr=m.mpStr.replace(/<\/?mp>/g,"")}catch(e){m.mpStr=this.subtreeToString(p.getElementsByTagName("data")[0].getElementsByTagName("content")[0]),m.mpStr=m.mpStr.replace(/<\/?content>/g,"")}m.fixed=!1;try{p.getElementsByTagName("data")[0].getElementsByTagName("parent")[0].firstChild&&(m.parent=p.getElementsByTagName("data")[0].getElementsByTagName("parent")[0].firstChild.data,m.fixed=!0)}catch(e){}try{m.condition=p.getElementsByTagName("condition")[0].firstChild.data}catch(e){m.condition=""}m.content=p.getElementsByTagName("content")[0].firstChild.data;try{m.fixed=p.getElementsByTagName("fix")[0].firstChild.data}catch(e){m.fixed=!1}try{m.autodigits=p.getElementsByTagName("digits")[0].firstChild.data}catch(e){m.autodigits=2}m.parent=this.changeOriginIds(i,m.parent),a=i.create("text",[parseFloat(m.x),parseFloat(m.y),m.mpStr],{anchor:m.parent,id:m.id,name:m.name,digits:m.autodigits,isLabel:!1,strokeColor:m.colorLabel,fixed:m.fixed,visible:JXG.str2Bool(m.visible)});break;case"parametercurve":m=this.colorProperties(m,p),m=this.visualProperties(m,p),m=this.firstLevelProperties(m,p),(m=this.transformProperties(m)).functionx=p.getElementsByTagName("functionx")[0].firstChild.data,m.functiony=p.getElementsByTagName("functiony")[0].firstChild.data,m.min=p.getElementsByTagName("min")[0].firstChild.data,m.max=p.getElementsByTagName("max")[0].firstChild.data,m.fillColor="none",m.highlightFillColor="none",i.create("curve",[i.jc.snippet(m.functionx,!0,"t",!0),i.jc.snippet(m.functiony,!0,"t",!0),i.jc.snippet(m.min,!0,"",!0),i.jc.snippet(m.max,!0,"",!0)],m),this.printDebugMessage("debug",m,p.nodeName,"OK");break;case"tracecurve":m.tracepoint=p.getElementsByTagName("tracepoint")[0].firstChild.data,m.traceslider=p.getElementsByTagName("traceslider")[0].firstChild.data,i.create("tracecurve",[m.traceslider,m.tracepoint],m),this.printDebugMessage("debug",m,p.nodeName,"OK");break;case"group":for(m=this.colorProperties(m,p),(m=this.firstLevelProperties(m,p)).members=[],s=0;s<p.getElementsByTagName("data")[0].getElementsByTagName("member").length;s++)m.members[s]=p.getElementsByTagName("data")[0].getElementsByTagName("member")[s].firstChild.data,m.members[s]=this.changeOriginIds(i,m.members[s]);a=new JXG.Group(i,m.id,m.name,m.members),this.printDebugMessage("debug",m,p.nodeName,"OK");break;default:JXG.debug("* Err: "+p.nodeName+" not yet implemented")}},read:function(){var e,t,i,r,s,o,a=this.tree,n=this.board,l="true";for(n.options.layer.sector=n.options.layer.angle,n.options.layer.circle=n.options.layer.angle,n.options.line.label.position="top",r=this.gEBTN(a,"board",0,!1),s=this.readConditions(r.getElementsByTagName("conditions")[0]),i=this.gEBTN(r,"background",0,!1),i=this.gEBTN(i,"color",0,!0),o=JXG.rgba2rgbo(i),i=JXG.rgbParser(o[0]),n.containerObj.style.backgroundColor="rgba("+i[0]+", "+i[1]+", "+i[2]+", "+o[1]+")",n.attr.takeSizeFromFile&&n.resizeContainer(this.gEBTN(r,"width"),this.gEBTN(r,"height")),e=this.gEBTN(r,"coordinates",0,!1),4===(o=this.readViewPort(e)).length?n.setBoundingBox(o,!0):(o=this.gEBTN(e,"zoom",0,!1),n.zoomX=parseFloat(this.gEBTN(o,"x")),n.zoomY=parseFloat(this.gEBTN(o,"y")),o=this.gEBTN(e,"origin",0,!1),n.origin={usrCoords:[1,0,0],scrCoords:[1,parseFloat(this.gEBTN(o,"x"))*n.zoomX,parseFloat(this.gEBTN(o,"y"))*n.zoomY]},o=this.gEBTN(e,"unit",0,!1),n.unitX=parseFloat(this.gEBTN(o,"x"))*n.zoomX,n.unitY=parseFloat(this.gEBTN(o,"y"))*n.zoomY),n.attr.takeSizeFromFile&&n.resizeContainer(this.gEBTN(r,"width"),this.gEBTN(r,"height")),parseFloat(n.options.text.fontSize)<0&&(n.options.text.fontSize=12),n.geonextCompatibilityMode=!0,delete JXG.boards[n.id],n.id=this.gEBTN(r,"id"),JXG.boards[n.id]=n,n.initGeonextBoard(),n.renderer.enhancedRendering=!0,this.parseImage(n,this.gEBTN(r,"file",0,!1),n.options.layer.image),n.options.point.snapToGrid=this.gEBTN(this.gEBTN(r,"coordinates",0,!1),"snap")===l,n.options.point.snapToGrid&&this.gEBTN(this.gEBTN(r,"grid",1,!1),"pointsnap")===l&&(n.options.point.snapToGrid=!1,n.options.point.snapToPoints=!0,n.options.point.attractorDistance=.5),e=this.gEBTN(r,"grid",1,!1),(o=this.gEBTN(e,"x"))&&(n.options.grid.gridX=1/parseFloat(o),n.options.point.snapSizeX=1/parseFloat(o)),(o=this.gEBTN(e,"y"))&&(n.options.grid.gridY=1/parseFloat(o),n.options.point.snapSizeY=1/parseFloat(o)),n.options.grid.gridDash=JXG.str2Bool(this.gEBTN(e,"dash")),o=JXG.rgba2rgbo(this.gEBTN(e,"color")),n.options.grid.gridColor=o[0],n.options.grid.gridOpacity=o[1],e=this.gEBTN(r,"coordinates",0,!1),this.gEBTN(e,"grid")===l&&n.create("grid",[]),this.gEBTN(e,"coord")===l&&(n.options.axis.ticks.majorHeight=10,n.options.axis.ticks.minorHeight=4,n.create("axis",[[0,0],[1,0]]),n.create("axis",[[0,0],[0,1]])),8===(o=this.gEBTN(this.gEBTN(r,"background",0,!1),"color")).length&&(o="#"+o),n.containerObj.style.backgroundColor=JXG.rgba2rgbo(o)[0],t=a.getElementsByTagName("elements")[0].childNodes,i=0;i<t.length;i++)this.readNode(t,i,n);n.addConditions(s)},decodeString:function(e){var t;return e.indexOf("<GEONEXT>")<0?""===(t=new JXG.Util.Unzip(JXG.Util.Base64.decodeAsArray(e)).unzip())?e:t:e},prepareString:function(e){try{e.indexOf("GEONEXT")<0&&(e=this.decodeString(e)[0][0]),e=this.fixXML(e)}catch(t){e=""}return e},fixXML:function(e){var t=["active","angle","animate","animated","arc","area","arrow","author","autodigits","axis","back","background","board","border","bottom","buttonsize","cas","circle","color","comment","composition","condition","conditions","content","continuous","control","coord","coordinates","cross","cs","dash","data","description","digits","direction","draft","editable","elements","event","file","fill","first","firstarrow","fix","fontsize","free","full","function","functionx","functiony","GEONEXT","graph","grid","group","height","id","image","info","information","input","intersection","item","jsf","label","last","lastarrow","left","lefttoolbar","lighting","line","loop","max","maximized","member","middle","midpoint","min","modifier","modus","mp","mpx","multi","name","onpolygon","order","origin","output","overline","parametercurve","parent","point","pointsnap","polygon","position","radius","radiusnum","radiusvalue","right","section","selectedlefttoolbar","showconstruction","showcoord","showinfo","showunit","showx","showy","size","slider","snap","speed","src","start","stop","straight","stroke","strokewidth","style","term","text","top","trace","tracecurve","tracepoint","traceslider","type","unit","value","VERSION","vertex","viewport","visible","width","wot","x","xooy","xval","y","yval","zoom"].join("|"),i=new RegExp("<(/?("+t+"))>","g");return e=(e=(e=(e=(e=JXG.escapeHTML(e)).replace(i,"<$1>")).replace(/(<content>.*)<arc>(.*<\/content>)/g,"$1<arc>$2")).replace(/(<mp>.*)<arc>(.*<\/mpx>)/g,"$1<arc>$2")).replace(/(<mpx>.*)<arc>(.*<\/mpx>)/g,"$1<arc>$2")}}),JXG.registerReader(JXG.GeonextReader,["gxt","geonext"])}();
|