Rev 8116 | Rev 8129 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8116 | Rev 8127 | ||
---|---|---|---|
Line 1311... | Line 1311... | ||
1311 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1311 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1312 | } |
1312 | } |
1313 | else |
1313 | else |
1314 | if( strcmp(draw_type,"inputs") == 0){ |
1314 | if( strcmp(draw_type,"inputs") == 0){ |
1315 | if( js_function[DRAW_INPUTS] != 1 ){ js_function[DRAW_INPUTS] = 1;} |
1315 | if( js_function[DRAW_INPUTS] != 1 ){ js_function[DRAW_INPUTS] = 1;} |
1316 | if(reply_format == 0){reply_format = |
1316 | if(reply_format == 0){reply_format = 27;} |
1317 | add_js_inputs(js_include_file,canvas_root_id,2,input_cnt,input_style,line_width); |
1317 | add_js_inputs(js_include_file,canvas_root_id,2,input_cnt,input_style,line_width); |
1318 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1318 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1319 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1319 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1320 | } |
1320 | } |
1321 | else |
1321 | else |
1322 | if( strcmp(draw_type,"input") == 0){ |
1322 | if( strcmp(draw_type,"input") == 0){ |
1323 | if( js_function[DRAW_INPUTS] != 1 ){ js_function[DRAW_INPUTS] = 1;} |
1323 | if( js_function[DRAW_INPUTS] != 1 ){ js_function[DRAW_INPUTS] = 1;} |
1324 | if(reply_format == 0){reply_format = |
1324 | if(reply_format == 0){reply_format = 27;} |
1325 | add_js_inputs(js_include_file,canvas_root_id,1,input_cnt,input_style,line_width); |
1325 | add_js_inputs(js_include_file,canvas_root_id,1,input_cnt,input_style,line_width); |
1326 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1326 | if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");} |
1327 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1327 | if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");} |
1328 | } |
1328 | } |
1329 | else |
1329 | else |
Line 2839... | Line 2839... | ||
2839 | @ replyformat number |
2839 | @ replyformat number |
2840 | @ use number=-1 to deactivate the js-function read_canvas() |
2840 | @ use number=-1 to deactivate the js-function read_canvas() |
2841 | @ default values should be fine ! |
2841 | @ default values should be fine ! |
2842 | @ use command 'precision [0,1,10,100,1000,10000...]' before command 'replyformat' to set the desired number of decimals in the student reply / drawing |
2842 | @ use command 'precision [0,1,10,100,1000,10000...]' before command 'replyformat' to set the desired number of decimals in the student reply / drawing |
2843 | @ the last value for 'precision int' will be used to calculate the reply coordinates, if needed (read_canvas();) |
2843 | @ the last value for 'precision int' will be used to calculate the reply coordinates, if needed (read_canvas();) |
2844 | @ choose<ul><li>1 = x1,x2,x3,x4....x_n<br />y1,y2,y3,y4....y_n<br /><br />x/y in pixels</li><li>2 = x1,x2,x3,x4....x_n<br /> y1,y2,y3,y4....y_n<br /> x/y in xrange / yrange coordinate system<br /></li><li>3 = x1,x2,x3,x4....x_n<br /> y1,y2,y3,y4....y_n<br /> r1,r2,r3,r4....r_n<br /> x/y in pixels <br /> r in pixels</li><li>4 = x1,x2,x3,x4....x_n<br /> y1,y2,y3,y4....y_n<br /> r1,r2,r3,r4....r_n<br /> x/y in xrange / yrange coordinate system<br /> r in pixels</li><li>5 = Ax1,Ax2,Ax3,Ax4....Ax_n<br /> Ay1,Ay2,Ay3,Ay4....Ay_n<br /> Bx1,Bx2,Bx3,Bx4....Bx_n<br /> By1,By2,By3,By4....By_n<br /> Cx1,Cx2,Cx3,Cx4....Cx_n<br /> Cy1,Cy2,Cy3,Cy4....Cy_n<br /> ....<br /> Zx1,Zx2,Zx3,Zx4....Zx_n<br /> Zy1,Zy2,Zy3,Zy4....Zy_n<br /> x/y in pixels<br /></li><li>6 = Ax1,Ax2,Ax3,Ax4....Ax_n<br /> Ay1,Ay2,Ay3,Ay4....Ay_n<br /> Bx1,Bx2,Bx3,Bx4....Bx_n<br /> By1,By2,By3,By4....By_n<br /> Cx1,Cx2,Cx3,Cx4....Cx_n<br /> Cy1,Cy2,Cy3,Cy4....Cy_n<br /> ....<br /> Zx1,Zx2,Zx3,Zx4....Zx_n<br /> Zy1,Zy2,Zy3,Zy4....Zy_n<br /> x/y in xrange / yrange coordinate system<br /></li><li>7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n<br /> x/y in pixels</li><li>8 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n<br /> x/y in xrange / yrange coordinate system</li><li>9 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n<br /> x/y in pixels</li><li>10 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n<br /> x/y in xrange / yrange coordinate system</li><li>11 = Ax1,Ay1,Ax2,Ay2<br /> Bx1,By1,Bx2,By2<br /> Cx1,Cy1,Cx2,Cy2<br /> Dx1,Dy1,Dx2,Dy2<br /> ......<br /> Zx1,Zy1,Zx2,Zy2<br /> x/y in xrange / yrange coordinate system</li><li>12 = Ax1,Ay1,Ax2,Ay2<br /> Bx1,By1,Bx2,By2<br />Cx1,Cy1,Cx2,Cy2<br /> Dx1,Dy1,Dx2,Dy2<br /> ......<br /> Zx1,Zy1,Zx2,Zy2<br /> x/y in pixels</li><li>13 = Ax1:Ay1:Ax2:Ay2,Bx1:By1:Bx2:By2,Cx1:Cy1:Cx2:Cy2,Dx1:Dy1:Dx2:Dy2, ... ,Zx1:Zy1:Zx2:Zy2<br /> x/y in xrange / yrange coordinate system</li><li>14 = Ax1:Ay1:Ax2:Ay2,Bx1:By1:Bx2:By2....Zx1:Zy1:Zx2:Zy2<br /> x/y in pixels</li><li>15 = reply from inputfields,textareas<br /> reply1,reply2,reply3,...,reply_n</li><li>16 = mathml input fields </li><li>17 = read "userdraw text,color" only (x1:y1:text1,x2:y2:text2...x_n:y_n:text_n</li><li>18 = read_canvas() will read all interactive clocks in H1:M1:S1,H2:M2:S2...Hn:Mn:Sn</li><li>19 = read_canvas() will return the object number of marked / clicked object (clock)<br />analogue to (shape library) onclick command </li><li>21 = (x1:y1) (x2:y2) ... (x_n:y_n)<br />verbatim coordinate return</li>22 = returns an array .... reply[0]=x1 reply[1]=y1 reply[2]=x2 reply[3]=y2 ... reply[n-1]=x_n reply[n]=y_n<br /> x/y in xrange / yrange coordinate system</li><li>replyformat 23 : can only be used for drawtype 'polyline'<br />a typical click sequence in drawtype polyline isx1,y1,x2,y2,x2,y2,x3,y3,x3,y3.....,x(n-1),y(n-1),x(n-1),y(n-1),xn,yn --replyformat 23--> x1,y1,x2,y2,x3,y3,.....x(n-1),y(n-1),xn,yn multiple occurences will be filtered out.The reply will be in x-y-range (xreply \\n yreply)</li><li>replyformat 24 = read all inputfield values: even those set 'readonly'</li><li>format 25 = angle1,angle2...angle_n : will return the radius (one or many) of the user drawn circle segment in degrees </li><li>format 26 = rad1,rad2...rad_n : will return the radius (one or many) of the user drawn circle segment in radians </li></ul> |
2844 | @ choose<ul><li>1 = x1,x2,x3,x4....x_n<br />y1,y2,y3,y4....y_n<br /><br />x/y in pixels</li><li>2 = x1,x2,x3,x4....x_n<br /> y1,y2,y3,y4....y_n<br /> x/y in xrange / yrange coordinate system<br /></li><li>3 = x1,x2,x3,x4....x_n<br /> y1,y2,y3,y4....y_n<br /> r1,r2,r3,r4....r_n<br /> x/y in pixels <br /> r in pixels</li><li>4 = x1,x2,x3,x4....x_n<br /> y1,y2,y3,y4....y_n<br /> r1,r2,r3,r4....r_n<br /> x/y in xrange / yrange coordinate system<br /> r in pixels</li><li>5 = Ax1,Ax2,Ax3,Ax4....Ax_n<br /> Ay1,Ay2,Ay3,Ay4....Ay_n<br /> Bx1,Bx2,Bx3,Bx4....Bx_n<br /> By1,By2,By3,By4....By_n<br /> Cx1,Cx2,Cx3,Cx4....Cx_n<br /> Cy1,Cy2,Cy3,Cy4....Cy_n<br /> ....<br /> Zx1,Zx2,Zx3,Zx4....Zx_n<br /> Zy1,Zy2,Zy3,Zy4....Zy_n<br /> x/y in pixels<br /></li><li>6 = Ax1,Ax2,Ax3,Ax4....Ax_n<br /> Ay1,Ay2,Ay3,Ay4....Ay_n<br /> Bx1,Bx2,Bx3,Bx4....Bx_n<br /> By1,By2,By3,By4....By_n<br /> Cx1,Cx2,Cx3,Cx4....Cx_n<br /> Cy1,Cy2,Cy3,Cy4....Cy_n<br /> ....<br /> Zx1,Zx2,Zx3,Zx4....Zx_n<br /> Zy1,Zy2,Zy3,Zy4....Zy_n<br /> x/y in xrange / yrange coordinate system<br /></li><li>7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n<br /> x/y in pixels</li><li>8 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n<br /> x/y in xrange / yrange coordinate system</li><li>9 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n<br /> x/y in pixels</li><li>10 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n<br /> x/y in xrange / yrange coordinate system</li><li>11 = Ax1,Ay1,Ax2,Ay2<br /> Bx1,By1,Bx2,By2<br /> Cx1,Cy1,Cx2,Cy2<br /> Dx1,Dy1,Dx2,Dy2<br /> ......<br /> Zx1,Zy1,Zx2,Zy2<br /> x/y in xrange / yrange coordinate system</li><li>12 = Ax1,Ay1,Ax2,Ay2<br /> Bx1,By1,Bx2,By2<br />Cx1,Cy1,Cx2,Cy2<br /> Dx1,Dy1,Dx2,Dy2<br /> ......<br /> Zx1,Zy1,Zx2,Zy2<br /> x/y in pixels</li><li>13 = Ax1:Ay1:Ax2:Ay2,Bx1:By1:Bx2:By2,Cx1:Cy1:Cx2:Cy2,Dx1:Dy1:Dx2:Dy2, ... ,Zx1:Zy1:Zx2:Zy2<br /> x/y in xrange / yrange coordinate system</li><li>14 = Ax1:Ay1:Ax2:Ay2,Bx1:By1:Bx2:By2....Zx1:Zy1:Zx2:Zy2<br /> x/y in pixels</li><li>15 = reply from inputfields,textareas<br /> reply1,reply2,reply3,...,reply_n</li><li>16 = mathml input fields </li><li>17 = read "userdraw text,color" only (x1:y1:text1,x2:y2:text2...x_n:y_n:text_n</li><li>18 = read_canvas() will read all interactive clocks in H1:M1:S1,H2:M2:S2...Hn:Mn:Sn</li><li>19 = read_canvas() will return the object number of marked / clicked object (clock)<br />analogue to (shape library) onclick command </li><li>21 = (x1:y1) (x2:y2) ... (x_n:y_n)<br />verbatim coordinate return</li>22 = returns an array .... reply[0]=x1 reply[1]=y1 reply[2]=x2 reply[3]=y2 ... reply[n-1]=x_n reply[n]=y_n<br /> x/y in xrange / yrange coordinate system</li><li>replyformat 23 : can only be used for drawtype 'polyline'<br />a typical click sequence in drawtype polyline isx1,y1,x2,y2,x2,y2,x3,y3,x3,y3.....,x(n-1),y(n-1),x(n-1),y(n-1),xn,yn --replyformat 23--> x1,y1,x2,y2,x3,y3,.....x(n-1),y(n-1),xn,yn multiple occurences will be filtered out.The reply will be in x-y-range (xreply \\n yreply)</li><li>replyformat 24 = read all inputfield values: even those set 'readonly'</li><li>format 25 = angle1,angle2...angle_n : will return the radius (one or many) of the user drawn circle segment in degrees </li><li>format 26 = rad1,rad2...rad_n : will return the radius (one or many) of the user drawn circle segment in radians </li><li>27 = return (only) userdraw inputfields array: x1:y1:text1,x2:y2:text2...</li></ul> |
2845 | @ note to 'userdraw text,color' : the x / y-values are in pixels ! (this to avoid too lengthy calculations in javascript...) |
2845 | @ note to 'userdraw text,color' : the x / y-values are in pixels ! (this to avoid too lengthy calculations in javascript...) |
2846 | */ |
2846 | */ |
2847 | reply_format = (int) get_real(infile,1); |
2847 | reply_format = (int) get_real(infile,1); |
2848 | reply_precision = precision; |
2848 | reply_precision = precision; |
2849 | break; |
2849 | break; |
Line 3580... | Line 3580... | ||
3580 | x/y in xrange / yrange coordinate system |
3580 | x/y in xrange / yrange coordinate system |
3581 | 23 = answertype for a polyline : remove multiple occurences due to reclick on a point to create next polyline segment |
3581 | 23 = answertype for a polyline : remove multiple occurences due to reclick on a point to create next polyline segment |
3582 | 24 = read all inputfield values: even those set 'readonly' |
3582 | 24 = read all inputfield values: even those set 'readonly' |
3583 | 25 = return all userdrawn arcs in degrees: |
3583 | 25 = return all userdrawn arcs in degrees: |
3584 | 26 = return all userdrawn arcs in radians: |
3584 | 26 = return all userdrawn arcs in radians: |
- | 3585 | 27 = return (only) userdraw inputfields array: x1:y1:text1,x2:y2:text2... |
|
3585 | */ |
3586 | */ |
3586 | 3587 | ||
3587 | 3588 | ||
3588 | void add_read_canvas(int type_reply,int reply_precision){ |
3589 | void add_read_canvas(int type_reply,int reply_precision){ |
3589 | /* just 1 reply type allowed */ |
3590 | /* just 1 reply type allowed */ |
Line 4497... | Line 4498... | ||
4497 | return angle_reply;\ |
4498 | return angle_reply;\ |
4498 | };\n\ |
4499 | };\n\ |
4499 | <!-- end function 25 read_canvas() -->",reply_precision); |
4500 | <!-- end function 25 read_canvas() -->",reply_precision); |
4500 | break; |
4501 | break; |
4501 | case 26: |
4502 | case 26: |
4502 | fprintf(js_include_file,"\n<!-- begin function |
4503 | fprintf(js_include_file,"\n<!-- begin function 26 read_canvas() : angle(s) in radians-->\n\ |
4503 | read_canvas = function(){\ |
4504 | read_canvas = function(){\ |
4504 | if( userdraw_radius.length < 1){alert(\"nothing drawn...\");return;}\ |
4505 | if( userdraw_radius.length < 1){alert(\"nothing drawn...\");return;}\ |
4505 | var lu = userdraw_radius.length;\ |
4506 | var lu = userdraw_radius.length;\ |
4506 | var prec = %d;\ |
4507 | var prec = %d;\ |
4507 | var angle_reply = new Array(lu);\ |
4508 | var angle_reply = new Array(lu);\ |
4508 | for(var p = 0 ; p < lu ; p++){\ |
4509 | for(var p = 0 ; p < lu ; p++){\ |
4509 | angle_reply[p] = (Math.round(prec*(userdraw_radius[p])))/prec;\ |
4510 | angle_reply[p] = (Math.round(prec*(userdraw_radius[p])))/prec;\ |
4510 | };\ |
4511 | };\ |
4511 | return angle_reply;\ |
4512 | return angle_reply;\ |
4512 | };\n\ |
4513 | };\n\ |
4513 | <!-- end function |
4514 | <!-- end function 26 read_canvas() -->",reply_precision); |
- | 4515 | break; |
|
- | 4516 | case 27: |
|
- | 4517 | fprintf(js_include_file,"\n<!-- begin function 27 read_canvas() : inputfield(s) location and their values : -->\n\ |
|
- | 4518 | read_canvas = function(){\ |
|
- | 4519 | var lu = userdraw_x.length;\ |
|
- | 4520 | if( lu < 1){alert(\"nothing drawn...\");return;}\ |
|
- | 4521 | set_reply_precision();\ |
|
- | 4522 | var prec = %d;\ |
|
- | 4523 | for(var p = 0 ; p < lu ; p++){\ |
|
- | 4524 | reply[p] = (Math.round(prec*(px2x(userdraw_x[p]))))/prec+\":\"+(Math.round(prec*(px2y(userdraw_y[p]))))/prec+\":\"+ document.getElementById(\"canvas_input\"+p).value;\ |
|
- | 4525 | };\ |
|
- | 4526 | return reply;\ |
|
- | 4527 | };\n\ |
|
- | 4528 | <!-- end function 27 read_canvas() -->",reply_precision); |
|
4514 | break; |
4529 | break; |
4515 | default: canvas_error("hmmm unknown replyformat...");break; |
4530 | default: canvas_error("hmmm unknown replyformat...");break; |
4516 | } |
4531 | } |
4517 | return; |
4532 | return; |
4518 | } |
4533 | } |