Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update JSXGraph to 0.97.0

  • Loading branch information...
commit 57408e2762f9300cc8cf00fe7b5b44eb455e8917 1 parent 434c2d7
@migerh migerh authored
View
39 ajax/libs/jsxgraph/0.97/GeogebraReader.min.js
@@ -0,0 +1,39 @@
+/*
+ JSXGraph 0.97.0
+
+ Copyright 2008-2013
+ Matthias Ehmann,
+ Michael Gerhaeuser,
+ Carsten Miller,
+ Bianca Valentin,
+ Alfred Wassermann,
+ Peter Wilfahrt
+
+ This file is part of JSXGraph.
+
+ JSXGraph is free software dual licensed under the GNU LGPL or MIT License.
+
+ You can redistribute it and/or modify it under the terms of the
+
+ * GNU Lesser General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version
+ OR
+ * MIT License: https://github.com/jsxgraph/jsxgraph/blob/master/LICENSE.MIT
+
+ JSXGraph is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License and
+ the MIT License along with JSXGraph. If not, see <http://www.gnu.org/licenses/>
+ and <http://opensource.org/licenses/MIT/>.
+*/
+
+/**
+ * almond 0.2.5 Copyright (c) 2011-2012, The Dojo Foundation All Rights Reserved.
+ * Available via the MIT or new BSD license.
+ * see: http://github.com/jrburke/almond for details
+ */(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"+" Lookahead: "+labels[la]+" ('"+info.att+"')\n"+" Action: "+act+"\n"+" Source: '"+info.src.substr(info.offset,30)+(info.offset+30<info.src.length?"...":"")+"'\n"+" Stack: "+sstack.join()+"\n"+" Value 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(" Error 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(" Error recovery failed, terminating parse process...")}break}if(dbg_withtrace){dbg_print(" Error 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(" New 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(" Performing 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(" Popping "+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(" Pushing 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}}}}return false},checkElement:function(name){var input;if(!JXG.exists(this.ggbElements[name])||this.ggbElements[name]===""){input=this.getElement(name);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")&&evSettings.getAttribute("axes")==="true"){this.ggbElements.xAxis=this.board.create("axis",[[0,0],[1,0]],{strokeColor:"black",minorTicks:0});this.ggbElements.yAxis=this.board.create("axis",[[0,0],[0,1]],{strokeColor:"black",minorTicks:0})}},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,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);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.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);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].setProperty(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(that.board.select(input[0].id).Dist(that.board.select(input[1].id)).toFixed(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[1],input[0]],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);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];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"&nbsp;&nbsp;"+(slopeWidth>1?slopeWidth.toString():"")+" "+this.name+" = "+JXG.trimNumber((slopeWidth*input[0].getSlope()).toFixed(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].setProperty({visible:false});poly.borders[0].setProperty({strokeColor:attr.fillColor,strokeWidth:attr.strokeWidth,highlightStrokeColor:attr.fillColor,dash:attr.dash});poly.borders[1].setProperty({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(('+re2+").toFixed("+this.decimals+')) + "'}t=RegExp.$3;rx=t.match(/(.*?)" \+ (.+) \+ "(.*)/)}rx=t.match(/(.*?)" \+ (.+)/);if(rx){res=res+RegExp.$1+'" + JXG.trimNumber(('+this.ggbParse(RegExp.$2)+").toFixed("+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.ggbParse(this.functionParse(false,this.getElement(attr.name,true).getAttribute("exp")));JXG.debug(t[1]);p=this.board.create("text",[gxtEl.x,gxtEl.y,new Function("return "+t[0]+' + " " + JXG.trimNumber(parseFloat('+t[1]+").toFixed("+this.decimals+"));")],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"])})();
View
38 ajax/libs/jsxgraph/0.97/GeonextReader.min.js
@@ -0,0 +1,38 @@
+/*
+ JSXGraph 0.97.0
+
+ Copyright 2008-2013
+ Matthias Ehmann,
+ Michael Gerhaeuser,
+ Carsten Miller,
+ Bianca Valentin,
+ Alfred Wassermann,
+ Peter Wilfahrt
+
+ This file is part of JSXGraph.
+
+ JSXGraph is free software dual licensed under the GNU LGPL or MIT License.
+
+ You can redistribute it and/or modify it under the terms of the
+
+ * GNU Lesser General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version
+ OR
+ * MIT License: https://github.com/jsxgraph/jsxgraph/blob/master/LICENSE.MIT
+
+ JSXGraph is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License and
+ the MIT License along with JSXGraph. If not, see <http://www.gnu.org/licenses/>
+ and <http://opensource.org/licenses/MIT/>.
+*/
+
+/**
+ * almond 0.2.5 Copyright (c) 2011-2012, The Dojo Foundation All Rights Reserved.
+ * Available via the MIT or new BSD license.
+ * see: http://github.com/jrburke/almond for details
+ */(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;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.hide(el.label.content);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);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);gxtEl.out.point=gxtEl.outPoint;board.create("arrowparallel",[gxtEl.defEl[1],gxtEl.defEl[0]],gxtEl.out);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:[]};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.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].setProperty(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);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",[gxtEl.x,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="&lt;(/?("+list+"))&gt;",expr=new RegExp(regex,"g");str=JXG.escapeHTML(str);str=str.replace(expr,"<$1>");str=str.replace(/(<content>.*)<arc>(.*<\/content>)/g,"$1&lt;arc&gt;$2");str=str.replace(/(<mp>.*)<arc>(.*<\/mpx>)/g,"$1&lt;arc&gt;$2");str=str.replace(/(<mpx>.*)<arc>(.*<\/mpx>)/g,"$1&lt;arc&gt;$2");return str}});JXG.registerReader(JXG.GeonextReader,["gxt","geonext"])})();
View
38 ajax/libs/jsxgraph/0.97/IntergeoReader.min.js
@@ -0,0 +1,38 @@
+/*
+ JSXGraph 0.97.0
+
+ Copyright 2008-2013
+ Matthias Ehmann,
+ Michael Gerhaeuser,
+ Carsten Miller,
+ Bianca Valentin,
+ Alfred Wassermann,
+ Peter Wilfahrt
+
+ This file is part of JSXGraph.
+
+ JSXGraph is free software dual licensed under the GNU LGPL or MIT License.
+
+ You can redistribute it and/or modify it under the terms of the
+
+ * GNU Lesser General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version
+ OR
+ * MIT License: https://github.com/jsxgraph/jsxgraph/blob/master/LICENSE.MIT
+
+ JSXGraph is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License and
+ the MIT License along with JSXGraph. If not, see <http://www.gnu.org/licenses/>
+ and <http://opensource.org/licenses/MIT/>.
+*/
+
+/**
+ * almond 0.2.5 Copyright (c) 2011-2012, The Dojo Foundation All Rights Reserved.
+ * Available via the MIT or new BSD license.
+ * see: http://github.com/jrburke/almond for details
+ */(function(){"use strict";JXG.IntergeoReader=function(board,str){var xmlStr;this.board=board;xmlStr=this.prepareString(str);this.tree=JXG.XML.parse(xmlStr)};JXG.extend(JXG.IntergeoReader.prototype,{objects:{},read:function(){this.board.origin={};this.board.origin.usrCoords=[1,0,0];this.board.origin.scrCoords=[1,400,300];this.board.unitX=30;this.board.unitY=30;this.readElements(this.tree.getElementsByTagName("elements"));this.readConstraints(this.tree.getElementsByTagName("constraints"));this.cleanUp();this.board.fullUpdate();this.readDisplay(this.tree.getElementsByTagName("display"));this.board.fullUpdate()},readElement:function(tree,s){var node;node=tree[0].childNodes[s];if(node.nodeType>1){return}if(node.nodeName==="point"){this.storePoint(node)}else if(node.nodeName==="line"||node.nodeName==="line_segment"||node.nodeName==="ray"||node.nodeName==="vector"){this.storeLine(node)}else if(node.nodeName==="circle"){this.storeConic(node)}else if(node.nodeName==="conic"){this.storeConic(node)}else{JXG.debug("Not implemented: "+node.nodeName+" "+node.getAttribute("id"))}},readElements:function(tree){var s;for(s=0;s<tree[0].childNodes.length;s++){this.readElement(tree,s)}},storePoint:function(node){var i=0,j=0,l=0,p=node.childNodes[i],c=[],parents=[];while(p.nodeType>1){i+=1;p=node.childNodes[i]}if(p.nodeName==="homogeneous_coordinates"){for(j=0;j<p.childNodes.length;j++){if(p.childNodes[j].nodeType===1){if(p.childNodes[j].nodeName==="double"){c.push(p.childNodes[j].firstChild.data)}else if(p.childNodes[j].nodeName==="complex"){for(l=0;l<p.childNodes[j].childNodes.length;l++){if(p.childNodes[j].childNodes[l].nodeName==="double"){c.push(p.childNodes[j].childNodes[l].firstChild.data)}}}else{JXG.debug("Not implemented: "+p.childNodes[j].nodeName);return}}}for(j=0;j<c.length;j++){c[j]=parseFloat(c[j])}if(c.length===3){parents=[c[2],c[0],c[1]]}else if(c.length===6&&Math.abs(c[1])<1e-10&&Math.abs(c[3])<1e-10&&Math.abs(c[5])<1e-10){parents=[c[4],c[0],c[2]]}else{JXG.debug("type not supported, yet");return}}else if(p.nodeName==="euclidean_coordinates"||p.nodeName==="euclidian_coordinates"){for(j=0;j<p.childNodes.length;j++){if(p.childNodes[j].nodeType===1){c.push(p.childNodes[j].firstChild.data)}}for(j=0;j<c.length;j++){c[j]=parseFloat(c[j])}parents=[c[0],c[1]]}else if(p.nodeName==="polar_coordinates"){for(j=0;j<p.childNodes.length;j++){if(p.childNodes[j].nodeType===1){c.push(p.childNodes[j].firstChild.data)}}for(j=0;j<c.length;j++){c[j]=parseFloat(c[j])}parents=[c[0]*Math.cos(c[1]),c[0]*Math.sin(c[1])]}else{JXG.debug("This coordinate type is not yet implemented: "+p.nodeName);return}this.objects[node.getAttribute("id")]={id:node.getAttribute("id"),coords:null};this.objects[node.getAttribute("id")].coords=parents;this.objects[node.getAttribute("id")].id=node.getAttribute("id");this.objects[node.getAttribute("id")].exists=false;this.objects[node.getAttribute("id")].i2geoType="point"},storeLine:function(node){var i,p,c,j;this.objects[node.getAttribute("id")]={id:node.getAttribute("id"),coords:null};i=0;p=node.childNodes[i];while(p.nodeType>1){i+=1;p=node.childNodes[i]}if(p.nodeName==="homogeneous_coordinates"){c=[];for(j=0;j<p.childNodes.length;j++){if(p.childNodes[j].nodeType===1){if(p.childNodes[j].nodeName==="double"){c.push(parseFloat(p.childNodes[j].firstChild.data))}}}this.objects[node.getAttribute("id")].coords=c;this.objects[node.getAttribute("id")].id=node.getAttribute("id");this.objects[node.getAttribute("id")].exists=false;this.objects[node.getAttribute("id")].i2geoType="line"}},storeConic:function(node){var i,j,p,c;this.objects[node.getAttribute("id")]={id:node.getAttribute("id"),coords:null};i=0;p=node.childNodes[i];while(p.nodeType>1){i+=1;p=node.childNodes[i]}if(p.nodeName==="matrix"){c=[];for(j=0;j<p.childNodes.length;j++){if(p.childNodes[j].nodeType===1){if(p.childNodes[j].nodeName==="double"){c.push(parseFloat(p.childNodes[j].firstChild.data))}}}this.objects[node.getAttribute("id")].coords=c;this.objects[node.getAttribute("id")].id=node.getAttribute("id");this.objects[node.getAttribute("id")].exists=false;this.objects[node.getAttribute("id")].i2geoType="conic"}},readConstraint:function(tree,s){var param,node;node=tree[0].childNodes[s];if(node.nodeType>1){return}if(node.nodeName==="line_through_two_points"){this.addLineThroughTwoPoints(node,false)}else if(node.nodeName==="ray_from_point_through_point"){this.addLineThroughTwoPoints(node,true)}else if(node.nodeName==="line_through_point"){this.addLineThroughPoint(node)}else if(node.nodeName==="line_parallel_to_line_through_point"){this.addLineParallelToLineThroughPoint(node,false)}else if(node.nodeName==="ray_from_point_and_vector"){this.addLineParallelToLineThroughPoint(node,true)}else if(node.nodeName==="line_perpendicular_to_line_through_point"){this.addLinePerpendicularToLineThroughPoint(node)}else if(node.nodeName==="line_segment_by_points"){this.addLineSegmentByTwoPoints(node)}else if(node.nodeName==="vector_from_point_to_point"){this.addVectorFromPointToPoint(node)}else if(node.nodeName==="endpoints_of_line_segment"){this.addEndpointsOfLineSegment(node)}else if(node.nodeName==="free_line"){this.addFreeLine(node)}else if(node.nodeName==="point_on_line"){this.addPointOnLine(node)}else if(node.nodeName==="point_on_line_segment"){this.addPointOnLine(node)}else if(node.nodeName==="point_on_circle"){this.addPointOnCircle(node)}else if(node.nodeName==="angular_bisector_of_three_points"){this.addAngularBisectorOfThreePoints(node,false)}else if(node.nodeName==="angular_bisectors_of_two_lines"){this.addAngularBisectorsOfTwoLines(node)}else if(node.nodeName==="line_angular_bisector_of_three_points"){this.addAngularBisectorOfThreePoints(node,true)}else if(node.nodeName==="line_angular_bisectors_of_two_lines"){this.addAngularBisectorsOfTwoLines(node)}else if(node.nodeName==="midpoint_of_two_points"){this.addMidpointOfTwoPoints(node)}else if(node.nodeName==="midpoint"){this.addMidpointOfTwoPoints(node)}else if(node.nodeName==="midpoint_of_line_segment"||node.nodeName==="midpoint_line_segment"){this.addMidpointOfLineSegment(node)}else if(node.nodeName==="point_intersection_of_two_lines"){this.addPointIntersectionOfTwoLines(node)}else if(node.nodeName==="locus_defined_by_point"){this.addLocusDefinedByPoint(node)}else if(node.nodeName==="locus_defined_by_point_on_line"){this.addLocusDefinedByPointOnLine(node)}else if(node.nodeName==="locus_defined_by_point_on_line_segment"){this.addLocusDefinedByPointOnLine(node)}else if(node.nodeName==="locus_defined_by_line_through_point"){this.addLocusDefinedByLineThroughPoint(node)}else if(node.nodeName==="locus_defined_by_point_on_circle"){this.addLocusDefinedByPointOnCircle(node)}else if(node.nodeName==="circle_by_three_points"){this.addCircleByThreePoints(node)}else if(node.nodeName==="circle_by_center_and_point"){this.addCircleByCenterAndPoint(node)}else if(node.nodeName==="center_of_circle"){this.addCenterOfCircle(node)}else if(node.nodeName==="intersection_points_of_two_circles"){this.addIntersectionPointsOfTwoCircles(node)}else if(node.nodeName==="intersection_points_of_circle_and_line"){this.addIntersectionPointsOfCircleAndLine(node)}else if(node.nodeName==="other_intersection_point_of_two_circles"){this.addOtherIntersectionPointOfTwoCircles(node)}else if(node.nodeName==="other_intersection_point_of_circle_and_line"){this.addOtherIntersectionPointOfCircleAndLine(node)}else if(node.nodeName==="circle_tangent_lines_by_point"){this.addCircleTangentLinesByPoint(node)}else if(node.nodeName==="polygon_by_vertices"){this.addPolygonByVertices(node)}else{param=this.readParams(node);JXG.debug("readConstraints: not implemented: "+node.nodeName+": "+param[0])}},readConstraints:function(tree){var s;this.board.options.point.strokeColor="blue";this.board.options.point.fillColor="blue";for(s=0;s<tree[0].childNodes.length;s++){this.readConstraint(tree,s)}},setAttributes:function(o){o.setProperty({strokecolor:this.board.options.point.strokeColor,fillColor:this.board.options.point.fillColor})},readParams:function(node){var j,param=[];for(j=0;j<node.childNodes.length;j++){if(node.childNodes[j].nodeType===1){param.push(node.childNodes[j].firstChild.data)}}return param},addPoint:function(p){if(!p.exists){p.exists=true;p=this.board.create("point",p.coords,{name:p.id});p.setProperty({strokecolor:"red",fillColor:"red"})}return p},addLine:function(id){var j,c=this.objects[id].coords,el;for(j=0;j<c.length;j++){c[j]=parseFloat(c[j])}el=this.board.create("line",[c[2],c[0],c[1]],{name:id,strokeColor:"black",withLabel:true});this.objects[id]=el},addConic:function(p){var c;if(!p.exists){c=p.coords;p=this.board.create("conic",[c[0],c[4],c[8],c[1],c[5],c[2]],{name:p.id});p.exists=true}return p},cleanUp:function(){var p;for(p in this.objects){if(this.objects.hasOwnProperty(p)){if(this.objects[p].exists===false){if(this.objects[p].i2geoType==="point"){this.addPoint(this.objects[p])}else if(this.objects[p].i2geoType==="line"){this.addLine(this.objects[p])}else if(this.objects[p].i2geoType==="conic"){this.addConic(this.objects[p])}else{JXG.debug("forgotten: "+this.objects[p].id+" of type "+this.objects[p].i2geoType)}}}}},addLineThroughTwoPoints:function(node,isRay){var el1,el2,el,param=this.readParams(node);el1=this.addPoint(this.objects[param[1]]);el2=this.addPoint(this.objects[param[2]]);el=this.board.create("line",[el1.id,el2.id],{name:param[0],withLabel:true,straightFirst:!isRay,straightLast:true});this.objects[param[0]]=el;this.objects[param[0]].exists=true},addLineThroughPoint:function(node){var param=this.readParams(node),j,c=this.objects[param[0]].coords,p=this.addPoint(this.objects[param[1]]),el;for(j=0;j<c.length;j++){c[j]=parseFloat(c[j])}el=this.board.create("line",[function(){return c[2]-c[0]*p.X()-c[1]*p.Y()-c[2]*p.Z()},c[0],c[1]],{name:param[0],strokeColor:"black",withLabel:true});this.objects[param[0]]=el;this.objects[param[0]].exists=true},addLineParallelToLineThroughPoint:function(node,isRay){var el1,el2,el,param=this.readParams(node);el1=this.addPoint(this.objects[param[1]]);el2=this.addPoint(this.objects[param[2]]);el=this.board.create("parallel",[el1.id,el2.id],{name:param[0],withLabel:true,straightFirst:!isRay,straightLast:true});this.objects[param[0]]=el;this.objects[param[0]].exists=true},addLinePerpendicularToLineThroughPoint:function(node){var el1,el2,el,param=this.readParams(node);el1=this.addPoint(this.objects[param[1]]);el2=this.addPoint(this.objects[param[2]]);el=this.board.create("perpendicular",[el1.id,el2.id],{name:param[0],id:param[0],straightFirst:true,straightLast:true,point:{name:param[0]+"foot",id:param[0]+"foot"},withLabel:true});this.objects[param[0]]=el;this.objects[param[0]].exists=true},addLineSegmentByTwoPoints:function(node){var el1,el2,el,param=this.readParams(node);el1=this.addPoint(this.objects[param[1]]);el2=this.addPoint(this.objects[param[2]]);el=this.board.create("line",[el1.id,el2.id],{name:param[0],straightFirst:false,straightLast:false,strokeColor:"black",withLabel:true});this.objects[param[0]]=el;this.objects[param[0]].exists=true},addPointIntersectionOfTwoLines:function(node){var param=this.readParams(node),l1=this.objects[param[1]],l2=this.objects[param[2]];this.objects[param[0]]=this.board.create("intersection",[l1,l2,0],{name:param[0],id:param[0],withLabel:true});this.setAttributes(this.objects[param[0]]);this.objects[param[0]].exists=true},addFreeLine:function(node){var param=this.readParams(node),a=this.objects[param[0]].coords[0],b=this.objects[param[0]].coords[1],c=this.objects[param[0]].coords[2],el=this.board.create("line",[c,a,b],{name:param[0],id:param[0],withLabel:true});this.objects[param[0]]=el;this.objects[param[0]].exists=true},addPointOnLine:function(node){var param=this.readParams(node),l=this.board.select(param[1]);this.board.create("glider",[0,0,l],{name:param[0],id:param[0],withLabel:true});this.objects[param[0]].exists=true},addPointOnCircle:function(node){var param=this.readParams(node),c=this.board.select(param[1]);c.update();this.board.create("glider",[this.objects[param[0]].coords[1],this.objects[param[0]].coords[2],c],{name:param[0],id:param[0],withLabel:true});this.objects[param[0]].exists=true},addEndpointsOfLineSegment:function(node){var param=this.readParams(node),line=this.objects[param[2]],p=this.addPoint(this.objects[param[0]]),q=this.addPoint(this.objects[param[1]]);p.addConstraint([function(){return line.point1.Z()},function(){return line.point1.X()},function(){return line.point1.Y()}]);q.addConstraint([function(){return line.point2.Z()},function(){return line.point2.X()},function(){return line.point2.Y()}]);this.setAttributes(p);this.setAttributes(q)},addAngularBisectorOfThreePoints:function(node,isLine){var el1,el2,el3,el,param=this.readParams(node);el1=this.addPoint(this.objects[param[1]]);el2=this.addPoint(this.objects[param[2]]);el3=this.addPoint(this.objects[param[3]]);el=this.board.create("bisector",[el1.id,el2.id,el3.id],{name:param[0],id:param[0],withLabel:true,straightFirst:isLine,straightLast:true,strokeColor:"#000000"});this.objects[param[0]]=el;this.objects[param[0]].exists=true},addMidpointOfTwoPoints:function(node){var el1,el2,el,param=this.readParams(node);el1=this.addPoint(this.objects[param[1]]);el2=this.addPoint(this.objects[param[2]]);el=this.board.create("midpoint",[el1.id,el2.id],{name:param[0]});this.setAttributes(el);this.objects[param[0]].exists=true},addMidpointOfLineSegment:function(node){var param=this.readParams(node),l=this.board.select(param[1]),el=this.board.create("midpoint",[l.point1,l.point2],{name:param[0]});this.setAttributes(el);this.objects[param[0]].exists=true},addCircleByThreePoints:function(node){var i,param=this.readParams(node),p=[];for(i=0;i<3;i++){p[i]=this.addPoint(this.objects[param[i+1]])}this.board.create("circumcircle",p,{name:param[0],id:param[0],point:{name:param[0]+"c",id:param[0]+"c"},withLabel:true});this.objects[param[0]].exists=true},addCenterOfCircle:function(node){var param=this.readParams(node),c=this.board.select(param[1]),el=this.board.create("point",[function(){return c.center.X()},function(){return c.center.Y()}],{name:param[0],id:param[0],withLabel:true});this.setAttributes(el);this.objects[param[0]].exists=true},addCircleTangentLinesByPoint:function(node){var polar,i1,i2,t1,t2,param=this.readParams(node),c=this.board.select(param[2]),p=this.addPoint(this.objects[param[3]]);polar=this.board.create("line",[function(){return JXG.Math.matVecMult(c.quadraticform,p.coords.usrCoords)[0]},function(){return JXG.Math.matVecMult(c.quadraticform,p.coords.usrCoords)[1]},function(){return JXG.Math.matVecMult(c.quadraticform,p.coords.usrCoords)[2]}],{visible:false});i1=this.board.create("intersection",[c,polar,0],{visible:false});i2=this.board.create("intersection",[c,polar,1],{visible:false});t1=this.board.create("tangent",[i1,c]);t2=this.board.create("tangent",[i2,c]);this.objects[param[0]]=t1;this.objects[param[1]]=t2;this.objects[param[0]].exists=true;this.objects[param[1]].exists=true},addIntersectionPointsOfTwoCircles:function(node){var p1,p2,param=this.readParams(node),c1=this.board.select(param[2]),c2=this.board.select(param[3]);p1=this.board.create("intersection",[c1,c2,0],{name:param[0],id:param[0],withLabel:true});p2=this.board.create("intersection",[c1,c2,1],{name:param[1],id:param[1],withLabel:true});this.setAttributes(p1);this.setAttributes(p2);this.objects[param[0]].exists=true;this.objects[param[1]].exists=true},addIntersectionPointsOfCircleAndLine:function(node){var p1,p2,param=this.readParams(node),c1=this.board.select(param[2]),c2=this.board.select(param[3]);p1=this.board.create("intersection",[c1,c2,0],{name:param[0],id:param[0],withLabel:true});p2=this.board.create("intersection",[c1,c2,1],{name:param[1],id:param[1],withLabel:true});this.setAttributes(p1);this.setAttributes(p2);this.objects[param[0]].exists=true;this.objects[param[1]].exists=true},addCircleByCenterAndPoint:function(node){var param=this.readParams(node),el1=this.addPoint(this.objects[param[1]]),el2=this.addPoint(this.objects[param[2]]);this.board.create("circle",[el1.id,el2.id],{name:param[0],id:param[0],withLabel:true});this.objects[param[0]].exists=true},addOtherIntersectionPointOfTwoCircles:function(node){var param=this.readParams(node),c1=this.board.select(param[2]),c2=this.board.select(param[3]),p1=this.board.select(param[1]),p2;p2=this.board.create("otherintersection",[c1,c2,p1],{name:param[0],id:param[0],withLabel:true});this.setAttributes(p2);this.objects[param[0]].exists=true},addOtherIntersectionPointOfCircleAndLine:function(node){this.addOtherIntersectionPointOfTwoCircles(node)},addAngularBisectorsOfTwoLines:function(node){var param=this.readParams(node),l1=this.objects[param[2]],l2=this.objects[param[3]];this.board.create("bisectorlines",[l1,l2],{line1:{name:param[0],id:param[0],straightFirst:true,straightLast:true},line2:{name:param[1],id:param[1],straightFirst:true,straightLast:true},withLabel:true});this.objects[param[0]].exists=true;this.objects[param[1]].exists=true},addPolygonByVertices:function(node){var j,n,param2=[],p=[],param=this.readParams(node);for(j=0;j<node.childNodes.length;j++){if(node.childNodes[j].nodeType===1){if(node.childNodes[j].nodeName==="list_of_vertices"){n=node.childNodes[j];param2=this.readParams(n);break}}}for(j=0;j<param2.length;j++){p.push(this.addPoint(this.objects[param2[j]]))}this.board.create("polygon",p,{name:param[0],id:param[0],withLabel:true});this.objects[param[0]].exists=true},addVectorFromPointToPoint:function(node){var el,el1,el2,param=this.readParams(node);el1=this.addPoint(this.objects[param[1]]);el2=this.addPoint(this.objects[param[2]]);el=this.board.create("arrow",[el1.id,el2.id],{name:param[0]});this.setAttributes(el);this.objects[param[0]].exists=true},addLocusDefinedByPoint:function(node){var param=this.readParams(node),el=this.board.select(param[1]);el.setProperty({trace:true});this.objects[param[1]]=el;this.setAttributes(el)},addLocusDefinedByPointOnLine:function(node){var param=this.readParams(node),el=this.board.select(param[1]);el.setProperty({trace:true});this.objects[param[1]]=el;this.setAttributes(el)},addLocusDefinedByLineThroughPoint:function(node){var param=this.readParams(node),el=this.board.select(param[1]);el.setProperty({trace:true});this.objects[param[1]]=el;this.setAttributes(el)},addLocusDefinedByPointOnCircle:function(node){var param=this.readParams(node),el=this.board.select(param[1]);el.setProperty({trace:true});this.objects[param[1]]=el;this.setAttributes(el)},prepareString:function(fileStr){var i,bA=[],isZip=false;if(fileStr.slice(0,2)==="PK"||JXG.Util.UTF8.asciiCharCodeAt(fileStr.slice(0,1),0)===31){isZip=true}if(!isZip&&fileStr.indexOf("<")!==0){fileStr=JXG.Util.Base64.decode(fileStr)}if(fileStr.indexOf("<")!==0){for(i=0;i<fileStr.length;i++){bA[i]=JXG.Util.UTF8.asciiCharCodeAt(fileStr,i)}fileStr=new JXG.Util.Unzip(bA).unzipFile("construction/intergeo.xml")}return fileStr},readDisplayProperty:function(tree,s){var j,node,el,prop={},key,val;node=tree[0].childNodes[s];if(node.nodeType>1){return}if(node.nodeName==="background-color"){this.board.containerObj.style.backgroundColor=node.firstChild.data}else if(node.nodeName==="style"){el=this.board.select(node.getAttribute("ref"));for(j=0;j<node.childNodes.length;j++){if(node.childNodes[j].nodeType===1){key=node.childNodes[j].nodeName;val=node.childNodes[j].firstChild.data;if(key==="stroke"){key="strokeColor"}else if(key==="stroke-width"||key==="border-width"){key="strokeWidth"}else if(key==="fill"){key="fillColor"}else if(key==="fill-opacity"){key="fillOpacity"}else if(key==="border-opacity"){key="strokeOpacity"}else if(key==="point-size"){key="size"}else if(key==="label"){key="name"}else if(key==="point-style"){key="face";if(val==="circle"){val="o"}else if(val==="cross"){val="+"}else if(val==="x-mark"){val="x"}else if(val==="square"){val="[]"}else if(val==="triangle"){val="triangleup"}else if(val==="point"){val="o"}else{JXG.debug("Display: not implemented"+node.nodeName)}}prop[key]=val}}el.setProperty(prop)}else{JXG.debug("Display: not implemented"+node.nodeName)}},readDisplay:function(tree){var s;if(!JXG.exists(tree)||!JXG.isArray(tree)){return}for(s=0;s<tree[0].childNodes.length;s++){this.readDisplayProperty(tree,s)}}});JXG.registerReader(JXG.IntergeoReader,["i2g","xml","intergeo"])})();
View
38 ajax/libs/jsxgraph/0.97/SketchReader.min.js
@@ -0,0 +1,38 @@
+/*
+ JSXGraph 0.97.0
+
+ Copyright 2008-2013
+ Matthias Ehmann,
+ Michael Gerhaeuser,
+ Carsten Miller,
+ Bianca Valentin,
+ Alfred Wassermann,
+ Peter Wilfahrt
+
+ This file is part of JSXGraph.
+
+ JSXGraph is free software dual licensed under the GNU LGPL or MIT License.
+
+ You can redistribute it and/or modify it under the terms of the
+
+ * GNU Lesser General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version
+ OR
+ * MIT License: https://github.com/jsxgraph/jsxgraph/blob/master/LICENSE.MIT
+
+ JSXGraph is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License and
+ the MIT License along with JSXGraph. If not, see <http://www.gnu.org/licenses/>
+ and <http://opensource.org/licenses/MIT/>.
+*/
+
+/**
+ * almond 0.2.5 Copyright (c) 2011-2012, The Dojo Foundation All Rights Reserved.
+ * Available via the MIT or new BSD license.
+ * see: http://github.com/jrburke/almond for details
+ */(function(){"use strict";JXG.SketchReader=function(board,str){this.read=function(){var i,t,arr,unzipped,meta,constr;unzipped=new JXG.Util.Unzip(JXG.Util.Base64.decodeAsArray(str)).unzip();if(!JXG.exists(unzipped[0])){return""}unzipped=JXG.Util.UTF8.decode(unzipped[0][0]);constr=JSON.parse(unzipped);meta=constr.pop();if(!JXG.exists(meta.unredo)){t=constr.length-1}else{t=meta.unredo}for(i=0;i<=t;i++){if(constr[i].type!==0){try{if(constr[i]>50){arr=JXG.SketchReader.generateJCodeMeta(constr[i],board)}else{arr=JXG.SketchReader.generateJCode(constr[i],board,constr)}}catch(e){JXG.debug("#steps: "+constr.length);JXG.debug("step: "+i+", type: "+constr[i].type);JXG.debug(constr[i])}board.jc.parse(arr[0],true)}}arr=meta.boundingBox;board.jc.parse("$board.setView("+JSON.stringify(arr)+");");return""}};JXG.extend(JXG.SketchReader,{generateJCodeMeta:function(){return["","","",""]},id:function(){return JXG.Util.genUUID()},generator:{toFixed:8,freeLine:false,useGlider:false,useSymbols:false},generateJCode:function(step,board,step_log){var i,j,k,sub_id,str,str1,str2,objects,pid1,pid2,pid3,xstart,ystart,el,arr,step2,options,assign,attrid,copy_log=[],set_str="",reset_str="",ctx_set_str="",ctx_reset_str="",pn=function(v){if(options.toFixed>0){v=parseFloat(v);v=v.toFixed(options.toFixed)}return v},getObject=function(v){var o;if(options.useSymbols){if(board.jc.sstack[0][v]){o=board.jc.sstack[0][v]}else{o=objects[v]}}else{o=objects[v]}return o};options=JXG.SketchReader.generator;objects=board.objects;assign="";attrid="id: '"+step.dest_id+"', ";if(JXG.exists(board)&&options.useSymbols&&step.type!==JXG.GENTYPE_ABLATION){attrid="";assign=step.dest_id+" = ";for(i=0;i<step.src_ids.length;i++){str=board.jc.findSymbol(getObject(step.src_ids[i]),0);if(str.length>0){step.src_ids[i]=str[0]}}}if(step.type>50){return JXG.SketchReader.generateJCodeMeta(step,board)}switch(step.type){case JXG.GENTYPE_JCODE:set_str=step.args.code;break;case JXG.GENTYPE_AXIS:set_str=step.args.name[0]+" = point("+step.args.coords[0].usrCoords[1]+", ";set_str+=step.args.coords[0].usrCoords[2]+") <<id: '"+step.dest_sub_ids[0]+"', name: '";set_str+=step.args.name[0]+"', fixed: true, priv: true, visible: false>>; "+step.args.name[1];set_str+=" = point("+step.args.coords[1].usrCoords[1]+", ";set_str+=step.args.coords[1].usrCoords[2]+") <<id: '"+step.dest_sub_ids[1]+"', name: '";set_str+=step.args.name[1]+"', fixed: true, priv: true, visible: false>>; "+step.args.name[2];set_str+=" = point("+step.args.coords[2].usrCoords[1]+", ";set_str+=step.args.coords[2].usrCoords[2]+") <<id: '"+step.dest_sub_ids[2]+"', name: '";set_str+=step.args.name[2]+"', fixed: true, priv: true, visible: false>>; ";set_str+=step.args.name[3]+" = axis("+step.args.name[0]+", "+step.args.name[1]+") ";set_str+="<<id: '"+step.dest_sub_ids[3]+"', name: '"+step.args.name[3]+"', ticks: ";set_str+="<<minorHeight:0, majorHeight:10, ticksDistance: "+JXG.Options.axisScaleX;set_str+=", drawLabels: true, drawZero: true>>>>; ";set_str+=step.args.name[4]+" = axis("+step.args.name[0]+", "+step.args.name[2]+") ";set_str+="<<id: '"+step.dest_sub_ids[4]+"', name: '"+step.args.name[4]+"', ticks: ";set_str+="<<minorHeight:0, majorHeight:10, ticksDistance: "+JXG.Options.axisScaleY;set_str+=", drawLabels: true, drawZero: true>>>>; ";set_str+=step.dest_sub_ids[3]+".visible = false; ";set_str+=step.dest_sub_ids[4]+".visible = false; ";set_str+="delete jxgBoard1_infobox; ";reset_str="delete "+step.dest_sub_ids[4]+"; delete "+step.dest_sub_ids[3];reset_str+="; delete "+step.dest_sub_ids[2]+"; ";reset_str+="delete "+step.dest_sub_ids[1]+"; delete "+step.dest_sub_ids[0]+"; ";break;case JXG.GENTYPE_MID:set_str=assign+"midpoint("+step.src_ids[0]+", "+step.src_ids[1]+") <<"+attrid;set_str+="fillColor: '"+step.args.fillColor+"'>>; ";reset_str="delete "+step.dest_id+"; ";break;case JXG.GENTYPE_REFLECTION:set_str=assign+"reflection("+step.src_ids[0]+", "+step.src_ids[1]+") <<"+attrid;set_str+="fillColor: '"+step.args.fillColor+"'>>; ";reset_str="delete "+step.dest_id+"; ";break;case JXG.GENTYPE_MIRRORPOINT:set_str=assign+"mirrorpoint("+step.src_ids[1]+", "+step.src_ids[0]+") <<"+attrid;set_str+="fillColor: '"+step.args.fillColor+"'>>; ";reset_str="delete "+step.dest_id+"; ";break;case JXG.GENTYPE_TANGENT:if(step.args.create_point){sub_id=step.dest_sub_ids[2];set_str="point("+pn(step.args.usrCoords[1])+","+pn(step.args.usrCoords[2])+") <<id: '";set_str+=sub_id+"', fillColor: '"+step.args.fillColor+"'>>; "+sub_id+".glide(";set_str+=step.src_ids[0]+"); ";reset_str="delete "+sub_id+"; "}else{sub_id=step.src_ids[0]}set_str+=assign+"tangent("+sub_id+") <<"+attrid+"point1: <<name: '"+step.dest_sub_ids[0];set_str+="', id: '"+step.dest_sub_ids[0]+"', priv: true>>, point2: <<name: '"+step.dest_sub_ids[1];set_str+="', id: '"+step.dest_sub_ids[1]+"', priv: true>> >>; ";reset_str="delete "+step.dest_sub_ids[0]+"; "+reset_str;reset_str="delete "+step.dest_id+"; delete "+step.dest_sub_ids[1]+"; "+reset_str;break;case JXG.GENTYPE_PARALLEL:if(step.args.create_point){sub_id=step.dest_sub_ids[1];set_str="point("+pn(step.args.usrCoords[1])+", "+pn(step.args.usrCoords[2])+") <<id: '";set_str+=sub_id+"', name: '', visible: false, priv: true>>; ";reset_str="delete "+sub_id+"; "}else{sub_id=step.src_ids[1]}set_str+=assign+"parallel("+step.src_ids[0]+", "+sub_id+") <<"+attrid+"point: <<id: '";set_str+=step.dest_sub_ids[0]+"', name: '"+step.dest_sub_ids[0]+"'>> >>; ";reset_str="delete "+step.dest_id+"; delete "+step.dest_sub_ids[0]+"; "+reset_str;break;case JXG.GENTYPE_BISECTORLINES:set_str="bisectorlines("+step.src_ids[0]+", "+step.src_ids[1]+") <<line1: <<id: '";set_str=set_str+step.dest_sub_ids[2]+"', point1: <<id: '"+step.dest_sub_ids[1];set_str+="', name: '"+step.dest_sub_ids[1]+"'>>, point2: <<id: '"+step.dest_sub_ids[0];set_str+="', name: '"+step.dest_sub_ids[0]+"'>>>>, line2: <<id: '"+step.dest_sub_ids[5];set_str+="', point1: <<id: '"+step.dest_sub_ids[4]+"', name: '"+step.dest_sub_ids[4];set_str+="'>>, point2: <<id: '"+step.dest_sub_ids[3]+"', name: '"+step.dest_sub_ids[3];set_str+="'>>>>>>; ";reset_str="delete "+step.dest_sub_ids[5]+"; delete "+step.dest_sub_ids[4]+"; delete ";reset_str+=step.dest_sub_ids[3]+"; delete "+step.dest_sub_ids[2]+"; delete ";reset_str+=step.dest_sub_ids[1]+"; delete "+step.dest_sub_ids[0]+"; ";break;case JXG.GENTYPE_BISECTOR:if(step.args.create_point){pid1=step.dest_sub_ids[1];set_str="point("+pn(step.args.usrCoords[1])+", "+pn(step.args.usrCoords[2])+") ";set_str+="<<id:'"+pid1+"', ";set_str+="name:'', priv:true, visible:false >>; ";set_str+=pid1+".glide("+step.src_ids[0]+"); ";reset_str="delete "+pid1+"; ";pid2=step.dest_sub_ids[2];set_str+="point("+pn(step.args.usrCoords[1])+", "+pn(step.args.usrCoords[2])+") ";set_str+="<<id:'"+pid2+"', ";set_str+="name:'', priv:true, visible:false >>; ";set_str+=pid2+".glide("+step.src_ids[1]+"); ";reset_str+="delete "+pid2+"; ";if(step.args.create_intersection){pid3=step.dest_sub_ids[3];set_str+="intersection("+step.src_ids[0]+", "+step.src_ids[1]+", 0) ";set_str+="<<id:'"+pid3+"', fillColor: '"+step.args.fillColor+"', ";set_str+="name:'', priv:true, visible:false >>; ";reset_str+="delete "+pid3+"; "}else{pid3=step.src_ids[2]}set_str+=assign+"bisector("+pid1+", "+pid3+", "+pid2+") ";set_str+="<<"+attrid+"point: <<id: '"+step.dest_sub_ids[0]+"', priv: true, name: '";set_str+=step.dest_sub_ids[0]+"'>> >>;";reset_str+="delete "+step.dest_id+"; delete "+step.dest_sub_ids[0]+";"}else{set_str=assign+"bisector("+step.src_ids[1]+", "+step.src_ids[2]+", "+step.src_ids[0];set_str+=") <<"+attrid+"point: <<id: '"+step.dest_sub_ids[0]+"', priv: true, name: '";set_str+=step.dest_sub_ids[0]+"'>>>>;";reset_str="delete "+step.dest_id+"; delete "+step.dest_sub_ids[0]+";"}break;case JXG.GENTYPE_NORMAL:if(step.args.create_point){sub_id=step.dest_sub_ids[1];set_str="point("+pn(step.args.usrCoords[1])+", "+pn(step.args.usrCoords[2]);set_str+=") <<id: '"+sub_id+"', name: '', visible: false, priv: true>>; ";reset_str="delete "+sub_id+"; "}else{sub_id=step.src_ids[1]}set_str+=assign+"normal("+sub_id+", "+step.src_ids[0]+") <<"+attrid;set_str+="point: <<id: '"+step.dest_sub_ids[0]+"', name: '"+step.dest_sub_ids[0];set_str+="'>> >>; ";reset_str="delete "+step.dest_id+"; delete "+step.dest_sub_ids[0]+"; "+reset_str;break;case JXG.GENTYPE_POINT:set_str=assign+"point("+pn(step.args.usrCoords[1])+", "+pn(step.args.usrCoords[2]);set_str+=")"+(options.useSymbols?"":" <<id: '"+step.dest_id+"'"+", snaptogrid: "+JXG.Options.elements.snapToGrid+", snaptopoints: "+JXG.Options.elements.snapToPoints+">>")+"; ";reset_str="delete "+step.dest_id+"; ";break;case JXG.GENTYPE_GLIDER:if(options.useGlider){set_str=assign+"glider("+pn(step.args.usrCoords[1])+", "+pn(step.args.usrCoords[2]);set_str+=", "+step.src_ids[0]+")";set_str+=(options.useSymbols?"":"<<id: '"+step.dest_id+"'"+", snaptogrid: false, snaptopoints: false"+", snaptopoints: "+JXG.Options.elements.snapToPoints+">>")+";"}else{set_str=assign+"point("+pn(step.args.usrCoords[1])+", "+pn(step.args.usrCoords[2]);set_str+=") <<"+attrid+"fillColor: '"+JXG.Options.glider.fillColor+"'>>; "+step.dest_id;set_str+=".glide("+step.src_ids[0]+"); "}if(!(step.args&&step.args.undoIsEmpty)){reset_str="delete "+step.dest_id+"; "}break;case JXG.GENTYPE_INTERSECTION:set_str=assign+"intersection("+step.src_ids[0]+", "+step.src_ids[1]+", "+step.args.choice;set_str+=") <<"+attrid+" fillColor: '"+JXG.Options.intersection.fillColor+"'>>; ";if(!(step.args&&step.args.undoIsEmpty)){reset_str="delete "+step.dest_id+"; "}break;case JXG.GENTYPE_MIGRATE:set_str="$board.migratePoint("+step.src_ids[0]+", "+step.dest_id+", false); ";if(step.args&&step.args.migrateToGlider){var o,gl,uc1,uc2;reset_str=step.dest_id+".free(); "+step.dest_id;reset_str+=".fillColor = '"+step.args.fillColor+"'; "+step.dest_id;reset_str+=".strokeColor = '"+step.args.strokeColor+"'; ";uc1=step.args.usrCoords[1];uc2=step.args.usrCoords[2];reset_str+="point("+uc1+", "+uc2+")";reset_str+=" <<id: '"+step.src_ids[0]+"', name: ''>>"+"; ";reset_str+="$board.migratePoint("+step.dest_id+", "+step.src_ids[0]+", false); ";reset_str+=step.src_ids[0]+".name = '"+step.args.orig_name+"'; ";reset_str+=step.src_ids[0]+".label.setText('"+step.args.orig_name+"'); ";o=board.objects[step.dest_id];gl=o.slideObject.id;uc1=o.coords.usrCoords[1];uc2=o.coords.usrCoords[2];reset_str+=assign+"point("+uc1+", "+uc2+") ";reset_str+="<<"+attrid+"fillColor: '"+JXG.Options.glider.fillColor+"'>>; ";reset_str+=step.dest_id+".glide("+gl+"); "}else{reset_str="delete "+step.dest_id+"; "}break;case JXG.GENTYPE_COMBINED:set_str=reset_str="";for(i=0;i<step.args.steps.length;i++){arr=this.generateJCode(step.args.steps[i],board,step_log);set_str=set_str+arr[0];reset_str=arr[2]+reset_str}break;case JXG.GENTYPE_CIRCLE:reset_str="delete "+step.dest_sub_ids[0]+"; ";if(step.args.create_point){set_str="point("+pn(step.args.usrCoords[1])+", "+pn(step.args.usrCoords[2]);set_str+=") <<id: '"+step.dest_sub_ids[0]+"', priv: false>>; ";set_str+=assign+"circle("+step.dest_sub_ids[0]+", "+step.src_ids[0]+") <<"+attrid;set_str+=" fillOpacity: "+JXG.Options.opacityLevel+", snaptogrid: "+JXG.Options.elements.snapToGrid+", snaptopoints: "+JXG.Options.elements.snapToPoints+">>;";reset_str="delete "+step.dest_id+"; "+reset_str}else if(step.args.create_by_radius){set_str="point("+pn(step.args.x)+", "+pn(step.args.y)+") <<id: '"+step.dest_sub_ids[0];set_str+="', name: '', withLabel: true, visible: true, priv: false>>; ";set_str+=step.dest_sub_ids[0]+".visible = true; ";set_str+=assign+"circle('"+step.dest_sub_ids[0]+"', "+pn(step.args.r)+") <<"+attrid;set_str+=" fillOpacity: "+JXG.Options.opacityLevel+", snaptogrid: "+JXG.Options.elements.snapToGrid+", snaptopoints: "+JXG.Options.elements.snapToPoints+">>;";reset_str="delete "+step.dest_id+"; delete "+step.dest_sub_ids[0]+"; "}else{set_str=assign+"circle("+step.src_ids[0]+", "+step.src_ids[1]+", "+step.src_ids[2];set_str+=") <<center: <<id: '"+step.dest_sub_ids[0]+"', name: '"+step.dest_sub_ids[0];set_str+="', visible: true>>, "+attrid+" fillOpacity: "+JXG.Options.opacityLevel+", snaptogrid: "+JXG.Options.elements.snapToGrid+", snaptopoints: "+JXG.Options.elements.snapToPoints+">>; ";reset_str="delete "+step.dest_id+"; "+reset_str}break;case JXG.GENTYPE_CIRCLE2POINTS:if(step.args.create_two_points){set_str="point("+pn(step.args.x1)+", "+pn(step.args.y1)+") <<id: '"+step.dest_sub_ids[0];set_str+="'>>; ";set_str+="point("+pn(step.args.x2)+", "+pn(step.args.y2)+") <<id: '";set_str+=step.dest_sub_ids[1]+"'>>; ";set_str+=assign+"circle("+step.dest_sub_ids[0]+", "+step.dest_sub_ids[1]+") <<"+attrid;set_str+=" fillOpacity: "+JXG.Options.opacityLevel+", snaptogrid: "+JXG.Options.elements.snapToGrid+", snaptopoints: "+JXG.Options.elements.snapToPoints+">>; ";reset_str="delete "+step.dest_id+"; delete "+step.dest_sub_ids[1]+"; delete ";reset_str+=step.dest_sub_ids[0]+"; "}else if(step.args.create_point){set_str="point("+pn(step.args.x)+", "+pn(step.args.y)+") <<id: '"+step.dest_sub_ids[0];set_str+="'>>; ";set_str+=assign+"circle("+step.dest_sub_ids[0]+", "+step.src_ids[0]+") <<"+attrid;set_str+=" fillOpacity: "+JXG.Options.opacityLevel+", snaptogrid: "+JXG.Options.elements.snapToGrid+", snaptopoints: "+JXG.Options.elements.snapToPoints+">>; ";reset_str="delete "+step.dest_id+"; delete "+step.dest_sub_ids[0]+"; "}else if(step.args.create_by_radius){set_str=assign+"circle("+step.src_ids[0]+", "+step.args.r+") <<"+attrid;set_str+=" fillOpacity: "+JXG.Options.opacityLevel+", snaptogrid: "+JXG.Options.elements.snapToGrid+", snaptopoints: "+JXG.Options.elements.snapToPoints+">>; ";reset_str="delete "+step.dest_id+"; "}else{set_str=assign+"circle("+step.src_ids[0]+", "+step.src_ids[1]+") <<"+attrid;set_str+=" fillOpacity: "+JXG.Options.opacityLevel+", snaptogrid: "+JXG.Options.elements.snapToGrid+", snaptopoints: "+JXG.Options.elements.snapToPoints+">>; ";reset_str="delete "+step.dest_id+"; "}break;case JXG.GENTYPE_LINE:k=0;j=0;if(step.args.create_point1){pid1=step.dest_sub_ids[k];k+=1;str1=[];for(i=0;i<step.args.p1.length;i++){str1[i]=pn(step.args.p1[i])}set_str="point("+str1.join(", ")+") <<id: '"+pid1+"', name: '', visible: false, ";set_str+="snaptogrid: false, snaptopoints: false, priv: true>>; ";reset_str="delete "+pid1+"; "}else{pid1=step.src_ids[j];j+=1}if(step.args.create_point2){pid2=step.dest_sub_ids[k++];str1=[];for(i=0;i<step.args.p2.length;i++){str1[i]=pn(step.args.p2[i])}set_str+="point("+str1.join(", ")+") <<id: '"+pid2+"', name: '', visible: false, ";set_str+="snaptogrid: false, snaptopoints: false, priv: true>>; ";reset_str="delete "+pid2+"; "+reset_str}else{pid2=step.src_ids[j];j+=1}str="line";str1="";str2=pid1+", "+pid2;if(step.args.create_point1&&step.args.create_point2&&options.freeLine){set_str="";reset_str="";if(step.args.p1.length===2){step.args.p1.unshift(1)}if(step.args.p2.length===2){step.args.p2.unshift(1)}str2=JXG.Math.crossProduct(step.args.p1,step.args.p2);for(i=0;i<str2.length;i++){str2[i]=pn(str2[i])}str2=str2.join(", ")}if(!step.args.first&&!step.args.last){str="segment"}else{if(!step.args.first){str1="straightFirst: "+step.args.first}if(!step.args.last){str1="straightLast: "+step.args.last}if(str1.length>0&&!options.useSymbols){str1+=", "}}if(!options.useSymbols){attrid="id: '"+step.dest_id+"'"}set_str+=assign+str+"("+str2+")";if(str1.length+attrid.length>0){set_str+=" <<"+str1+attrid+", snaptogrid: "+JXG.Options.elements.snapToGrid+", snaptopoints: "+JXG.Options.elements.snapToPoints+">>; "}else{set_str+=" <<"+"snaptogrid: "+JXG.Options.elements.snapToGrid+", snaptopoints: "+JXG.Options.elements.snapToPoints+">>; "}reset_str="delete "+step.dest_id+"; "+reset_str;break;case JXG.GENTYPE_TRIANGLE:for(i=0;i<step.args.create_point.length;i++){if(step.args.create_point[i]){set_str+="point("+pn(step.args.coords[i].usrCoords[1])+", ";set_str+=pn(step.args.coords[i].usrCoords[2])+") <<id: '"+step.dest_sub_ids[i];set_str+="'>>; "}}for(i=0;i<step.dest_sub_ids.length;i++){if(step.dest_sub_ids[i]!==0){reset_str="delete "+step.dest_sub_ids[i]+"; "+reset_str}}reset_str="delete "+step.dest_id+"; "+reset_str;set_str+=assign+"polygon(";for(i=0;i<step.src_ids.length;i++){set_str+=step.src_ids[i];if(i<step.src_ids.length-1){set_str+=", "}}for(i=0;i<3;i++){if(step.dest_sub_ids[i]!==0){if(step.src_ids.length>0||i>0){set_str+=", "}set_str+=step.dest_sub_ids[i]}}set_str+=") <<borders: <<ids: [ '"+step.dest_sub_ids[3]+"', '"+step.dest_sub_ids[4];set_str+="', '"+step.dest_sub_ids[5]+"' ]>>, "+attrid+" fillOpacity: ";set_str+=JXG.Options.opacityLevel+", hasInnerPoints:"+JXG.Options.polygon.hasInnerPoints+", scalable:true>>; ";break;case JXG.GENTYPE_QUADRILATERAL:for(i=0;i<step.args.create_point.length;i++){if(step.args.create_point[i]){set_str+="point("+pn(step.args.coords[i].usrCoords[1])+", ";set_str+=pn(step.args.coords[i].usrCoords[2])+") <<id: '"+step.dest_sub_ids[i];set_str+="'>>; "}}for(i=0;i<step.dest_sub_ids.length;i++){if(step.dest_sub_ids[i]!==0){reset_str="delete "+step.dest_sub_ids[i]+"; "+reset_str}}reset_str="delete "+step.dest_id+"; "+reset_str;set_str+=assign+"polygon(";for(i=0;i<step.src_ids.length;i++){set_str+=step.src_ids[i];if(i<step.src_ids.length-1){set_str+=", "}}set_str+=") <<borders: <<ids: [ '"+step.dest_sub_ids[4]+"', '"+step.dest_sub_ids[5];set_str+="', '";set_str+=step.dest_sub_ids[6]+"', '"+step.dest_sub_ids[7]+"' ]>>, "+attrid;set_str+=" fillOpacity: ";set_str+=JXG.Options.opacityLevel+", hasInnerPoints:true, scalable:true>>; ";break;case JXG.GENTYPE_TEXT:set_str=assign+"text("+pn(step.args.x)+", "+pn(step.args.y)+", "+step.args.str+") <<";set_str+=attrid+" name: '"+step.dest_id+"'";if(typeof step.args.anchor!="undefined"){set_str+=", anchor: "+step.args.anchor}set_str+=">>; "+step.dest_id+".setText("+step.args.str;set_str+="); ";reset_str="delete "+step.dest_id+"; ";break;case JXG.GENTYPE_RULER:set_str=assign+"tapemeasure([ "+step.args.p1+" ], [ "+step.args.p2+" ]) <<";set_str+=attrid+"name: '', point1: <<id: '"+step.dest_sub_ids[0]+"', snaptogrid: "+JXG.Options.elements.snapToGrid+", snaptopoints: "+JXG.Options.elements.snapToPoints+">>, "+"point2: <<id: '"+step.dest_sub_ids[1]+"'"+", snaptogrid: "+JXG.Options.elements.snapToGrid+", snaptopoints: "+JXG.Options.elements.snapToPoints+">> >>; ";reset_str="delete "+step.dest_id+"; ";break;case JXG.GENTYPE_POLYGON:set_str=assign+"polygon(";for(i=0;i<step.src_ids.length;i++){set_str+=step.src_ids[i];if(i!==step.src_ids.length-1){set_str+=", "}}set_str+=") <<borders: <<ids: [ '";for(i=0;i<step.dest_sub_ids.length;i++){set_str+=step.dest_sub_ids[i];if(i<step.dest_sub_ids.length-1){set_str+="', '"}}set_str+="' ]>>, "+attrid+" fillOpacity: "+JXG.Options.opacityLevel+" >>; ";reset_str="delete "+step.dest_id+"; ";break;case JXG.GENTYPE_REGULARPOLYGON:set_str=assign+"regularpolygon("+step.src_ids[0]+", "+step.src_ids[1]+", ";set_str+=step.args.corners+") <<borders: <<ids: [ ";for(i=0;i<step.args.corners;i++){set_str+="'"+step.dest_sub_ids[i]+"'";if(i!==step.args.corners-1){set_str+=", "}reset_str="delete "+step.dest_sub_ids[i]+"; "+reset_str}set_str+=" ]>>, vertices: <<ids: [ ";for(i=0;i<step.args.corners-2;i++){set_str+="'"+step.dest_sub_ids[i+parseInt(step.args.corners,10)]+"'";if(i!==step.args.corners-3){set_str+=", "}reset_str="delete "+step.dest_sub_ids[i+parseInt(step.args.corners,10)]+"; "+reset_str}set_str+=" ]>>, "+attrid+" fillOpacity: "+JXG.Options.opacityLevel+" >>; ";reset_str="delete "+step.dest_id+"; "+reset_str;break;case JXG.GENTYPE_SECTOR:set_str=assign+"sector("+step.src_ids[0]+", "+step.src_ids[1]+", "+step.src_ids[2];set_str+=") <<";set_str+=attrid+" name: '"+step.dest_id+"', fillOpacity: "+JXG.Options.opacityLevel;set_str+=">>; ";reset_str="delete "+step.dest_id+"; ";break;case JXG.GENTYPE_ANGLE:set_str=assign+"angle("+step.src_ids[0]+", "+step.src_ids[1]+", "+step.src_ids[2]+") ";set_str+="<<radiuspoint: << priv:true, id: '"+step.dest_sub_ids[0]+"', name: '"+step.dest_sub_ids[0];set_str+="'>>, pointsquare: << priv:true, id: '"+step.dest_sub_ids[1]+"', name: '"+step.dest_sub_ids[1];set_str+="'>>, dot: << priv:true, id: '"+step.dest_sub_ids[2]+"', name: '"+step.dest_sub_ids[2];set_str+="'>>, ";set_str+=attrid+" fillOpacity: "+JXG.Options.opacityLevel+">>; ";reset_str="delete "+step.dest_id+"; delete "+step.dest_sub_ids[2]+"; delete ";reset_str+=step.dest_sub_ids[1];reset_str+="; delete "+step.dest_sub_ids[0]+"; ";break;case JXG.GENTYPE_PLOT:if(typeof step.args.isUpdate=="undefined")step.args.isUpdate=false;if(step.args.isUpdate==false){set_str=assign+step.args.plot_type+"("+step.args.func+") <<";if(step.args.isPolar)set_str+="curveType: 'polar', ";set_str+=attrid+" name:'"+step.dest_id+"', strokeColor: '"+step.args.color+"'>>; ";reset_str="delete "+step.dest_id+"; "}else{set_str=step.dest_id+".generateTerm('x', 'x', '"+step.args.func.cleanTerm()+"'); $board.update();";reset_str=step.dest_id+".generateTerm('x', 'x', '"+step.args.funcOld.cleanTerm()+"'); $board.update();"}break;case JXG.GENTYPE_SLIDER:set_str=assign+"slider(["+pn(step.args.x1)+", "+pn(step.args.y1)+"], ["+pn(step.args.x2);set_str+=", "+pn(step.args.y2)+"], ["+pn(step.args.start)+", "+pn(step.args.ini)+", ";set_str+=pn(step.args.end)+"]) <<"+attrid+" name: '"+step.dest_id+"', baseline: <<id: '";set_str+=step.dest_sub_ids[0]+"', name: '"+step.dest_sub_ids[0]+"'>>, highline: <<id: '";set_str+=step.dest_sub_ids[1]+"', name: '"+step.dest_sub_ids[1]+"'>>, point1: <<id: '";set_str+=step.dest_sub_ids[2]+"', name: '"+step.dest_sub_ids[2]+"'>>, point2: <<id: '";set_str+=step.dest_sub_ids[3]+"', name: '"+step.dest_sub_ids[3]+"'>>, label: <<id: '";set_str+=step.dest_sub_ids[4]+"', name: '"+step.dest_sub_ids[4]+"'>>>>; ";reset_str="delete "+step.dest_id+"; delete "+step.dest_sub_ids[4]+"; delete ";reset_str+=step.dest_sub_ids[3]+"; delete "+step.dest_sub_ids[2]+"; delete ";reset_str+=step.dest_sub_ids[1]+"; delete ";reset_str+=step.dest_sub_ids[0]+"; ";break;case JXG.GENTYPE_DELETE:arr=[];ctx_set_str=[];ctx_reset_str=[];for(i=0;i<step.args.steps.length;i++){if(step_log[step.args.steps[i]].type>50){arr=this.generateJCodeMeta(step_log[step.args.steps[i]],board)}else{arr=this.generateJCode(step_log[step.args.steps[i]],board,step_log)}if(JXG.trim(arr[2])!==""){set_str=arr[2]+set_str}if(JXG.isFunction(arr[3])){ctx_set_str.unshift(arr[3])}if(JXG.trim(arr[0])!==""){reset_str+=arr[0]}if(JXG.isFunction(arr[1])){ctx_reset_str.push(arr[1])}}break;case JXG.GENTYPE_COPY:copy_log=[];for(el in step.args.steps){if(step.args.steps.hasOwnProperty(el)){step2=JXG.deepCopy(step_log[step.args.steps[el]]);if(step2.type===JXG.GENTYPE_COPY){for(i=0;i<step2.args.map.length;i++){for(j=0;j<step.args.map.length;j++){if(step2.args.map[i].copy===step.args.map[j].orig){step2.args.map[i].copy=step.args.map[j].copy}}}step2=JXG.SketchReader.replaceStepDestIds(step2,step2.args.map)}else{step2=JXG.SketchReader.replaceStepDestIds(step2,step.args.map)}copy_log.push(step2)}}for(i=0;i<copy_log.length;i++){if(copy_log[i].type>50){arr=this.generateJCodeMeta(copy_log[i],board)}else{arr=this.generateJCode(copy_log[i],board,step_log)}if(JXG.trim(arr[0])!==""){set_str+=arr[0]}if(JXG.isFunction(arr[1])){ctx_set_str.push(arr[1])}if(JXG.trim(arr[2])!==""){reset_str=arr[2]+reset_str}if(JXG.isFunction(arr[3])){ctx_reset_str.unshift(arr[3])}}if(step.args.dep_copy){for(i=0;i<step.args.map.length;i++){if(getObject(step.args.map[i].orig).elementClass===JXG.OBJECT_CLASS_POINT){set_str+=step.args.map[i].copy;set_str+=".X = function() { return ("+step.args.map[i].orig+".X() - ";set_str+=pn(step.args.x)+"); }; ";set_str+=step.args.map[i].copy;set_str+=".Y = function() { return ("+step.args.map[i].orig+".Y() - ";set_str+=pn(step.args.y)+"); }; "}}}else{for(i=0;i<step.args.free_points.length;i++){xstart=getObject(step.args.free_points[i].orig).coords.usrCoords[1];ystart=getObject(step.args.free_points[i].orig).coords.usrCoords[2];set_str+=step.args.free_points[i].copy+".X = function() { return ";set_str+=pn(xstart-step.args.x)+"; }; ";set_str+=step.args.free_points[i].copy+".Y = function() { return ";set_str+=pn(ystart-step.args.y)+"; }; ";set_str+=step.args.free_points[i].copy+".free(); "}}for(j=0;j<step.args.map.length;j++){el=getObject(step.args.map[j].orig);if(el.type===JXG.OBJECT_TYPE_CIRCLE&&!JXG.exists(el.point2)){set_str+=step.args.map[j].copy+".setRadius(function () { return ";set_str+=step.args.map[j].orig+".radius(); }); "}}break;case JXG.GENTYPE_ABLATION:xstart=getObject(step.src_ids[0]).coords.usrCoords[1];ystart=getObject(step.src_ids[0]).coords.usrCoords[2];set_str="point("+pn(xstart-step.args.x)+", "+pn(ystart-step.args.y)+") <<id: '";set_str+=step.dest_sub_ids[0]+"', withLabel: false>>; ";set_str+="circle('"+step.dest_sub_ids[0]+"', 1) <<id: '"+step.dest_sub_ids[1];set_str+="', fillOpacity: "+JXG.Options.opacityLevel+", strokeColor: '#888888', visible: true>>; ";if(step.args.fids.length===1){step.args.func=step.args.fids[0]+".radius()"}else{step.args.func="dist("+step.args.fids[0]+", "+step.args.fids[1]+")"}set_str+=step.dest_sub_ids[1]+".setRadius(function() { return "+step.args.func+"; }); ";if(step.args.migrate!==0&&step.args.migrate!==-1){set_str+="$board.migratePoint("+step.dest_sub_ids[0]+", "+step.args.migrate+"); "}reset_str="delete "+step.dest_sub_ids[1]+"; delete "+step.dest_sub_ids[0]+"; ";break;case JXG.GENTYPE_MOVEMENT:if(step.args.obj_type===JXG.OBJECT_TYPE_LINE){set_str=step.src_ids[0]+".move(["+pn(step.args.coords[0].usrCoords[0])+", ";set_str+=pn(step.args.coords[0].usrCoords[1])+", "+pn(step.args.coords[0].usrCoords[2])+"]); ";reset_str=step.src_ids[0]+".move(["+step.args.zstart[0]+", "+step.args.xstart[0]+", ";reset_str+=step.args.ystart[0]+"]); ";set_str+=step.src_ids[1]+".move(["+pn(step.args.coords[1].usrCoords[0])+", ";set_str+=pn(step.args.coords[1].usrCoords[1])+", "+pn(step.args.coords[1].usrCoords[2])+"]); ";reset_str+=step.src_ids[1]+".move(["+step.args.zstart[1]+", "+step.args.xstart[1]+", ";reset_str+=step.args.ystart[1]+"]); "}else if(step.args.obj_type===JXG.OBJECT_TYPE_CIRCLE){set_str=step.src_ids[0]+".move(["+pn(step.args.coords[0].usrCoords[1])+", ";set_str+=pn(step.args.coords[0].usrCoords[2])+"]); ";reset_str=step.src_ids[0]+".move(["+step.args.xstart+", "+step.args.ystart+"]); ";if(step.args.has_point2){set_str+=step.src_ids[1]+".move(["+pn(step.args.coords[1].usrCoords[1])+", ";set_str+=pn(step.args.coords[1].usrCoords[2])+"]); ";reset_str+=step.src_ids[1]+".move(["+step.args.old_p2x+", "+step.args.old_p2y;reset_str+="]); "}}else if(step.args.obj_type===JXG.OBJECT_TYPE_POLYGON){set_str=reset_str="";for(i=0;i<step.src_ids.length;i++){set_str+=step.src_ids[i]+".move(["+pn(step.args.coords[i].usrCoords[1])+", ";set_str+=pn(step.args.coords[i].usrCoords[2])+"]); ";reset_str+=step.src_ids[i]+".move(["+step.args.xstart[i]+", "+step.args.ystart[i];reset_str+="]); "}}else{set_str=step.src_ids[0]+".move(["+pn(step.args.coords[0].usrCoords[1])+", ";set_str+=pn(step.args.coords[0].usrCoords[2])+"]); ";reset_str=step.src_ids[0]+".move(["+step.args.xstart+", "+step.args.ystart+"]); "}break;default:JXG.debug("No such GENTYPE!"+step.type);return[]}return[set_str,ctx_set_str,reset_str,ctx_reset_str]},replaceStepDestIds:function(step,id_map){var i,j,copy_ids=[];for(i=0;i<id_map.length;i++){copy_ids.push(id_map[i].copy);if(step.dest_id===id_map[i].orig){step.dest_id=id_map[i].copy}for(j=0;j<step.dest_sub_ids.length;j++){if(step.dest_sub_ids[j]===id_map[i].orig){step.dest_sub_ids[j]=id_map[i].copy}}for(j=0;j<step.src_ids.length;j++){if(step.src_ids[j]===id_map[i].orig){step.src_ids[j]=id_map[i].copy}}}for(j=0;j<step.dest_sub_ids.length;j++){if(!JXG.isInArray(copy_ids,step.dest_sub_ids[j])){step.dest_sub_ids[j]=this.id()}}step.src_ids=JXG.uniqueArray(step.src_ids);step.dest_sub_ids=JXG.uniqueArray(step.dest_sub_ids);return step}});JXG.registerReader(JXG.SketchReader,["sketch","sketchometry"])})();
View
52 ajax/libs/jsxgraph/0.97/jsxgraphcore.min.js
52 additions, 0 deletions not shown
View
4 ajax/libs/jsxgraph/package.json
@@ -1,7 +1,7 @@
{
"name": "jsxgraph",
"filename": "jsxgraphcore.js",
- "version": "0.96",
+ "version": "0.97.0",
"description": "JSXGraph is a cross-browser library for interactive geometry, function plotting, charting, and data visualization in a web browser.",
"homepage": "http://jsxgraph.org/",
"keywords": [
@@ -12,7 +12,7 @@
"maintainers": [
{
"name": "JSXGraph group at University of Bayreuth, Germany"
- }
+ }
],
"repositories": [
{
Please sign in to comment.
Something went wrong with that request. Please try again.