100 ! Digitzast.BAS ! ! SUB digitizer_ast(N%,PC,PSL,RZERO,RONE) %include "digitcom.bas" EXTERNAL LONG FUNCTION OTS$CVT_TZ_L external integer function sys$cancel EXTERNAL LONG CONSTANT OTS$_INPCONERR map (temp) x_temp$ = 5% & ,y_temp$ = 5% bold$ = chr$(27) + "[1m" normal$ = chr$(27%) + "[0m" TABLE$ = " 0123456789ABCDEF" TALOS_IN$ = SEG$(BUFf$,1%,IOSB1) if status_cursor$ = "*" then goto asterisk_pressed else if status_cursor$ = "#" then goto pound_sign_pressed end if end if 150 x_temp$ = xlate(x_coord$,table$) y_temp$ = xlate(y_coord$,table$) RET_STAT% = OTS$CVT_TZ_L(x_temp$, x_coord%) RET_STAT% = OTS$CVT_TZ_L(y_temp$, y_coord%) if status_pen_down$ = "?" then goto send_one_qio end if if y_coord% > 5000 then !not in menu area goto exit_menu_check end if if x_coord% < 24400 or x_coord% > 27200 or y_coord% < 3150 then ! off digitizing area but not in menu proper goto send_one_qio end if reject% = 0% if x_coord% > 24400 and !are we rejecting a point? & x_coord% < 25200 and & y_coord% > 3150 then array_pointer% = array_pointer% - 1% reject% = -1% if array_pointer% < 0% and beep_on% then print chr$(7) goto cancel_io_and_wake else goto cancel_io_and_wake if array_pointer% < 0% end if end if if reject% then x_coord% = val%(seg$(output_array$(array_pointer%),3%,11%)) y_coord% = val%(seg$(output_array$(array_pointer%),12%,20%)) goto exit_menu_check end if if x_coord% > 25200 and !was beeper on/off pushed? & x_coord% < 26200 and & y_coord% > 3150 then beep_pressed% = -1% end if if beep_pressed% and beep_on% then beep_on% = 0% else beep_on% = -1% print chr$(7) end if if beep_pressed% then beep_pressed% = 0% goto send_one_qio end if if x_coord% > 26200 and !are we finishing the input? & x_coord% < 27150 and & y_coord% > 3150 then & goto cancel_io_and_wake end if exit_menu_check: if beep_on% and function_mode% <> 1% then print chr$(7) end if if function_mode% = 0% then call rotate else call rotate !y_coord% = (y_coord% + y_offset%) * y_scale !x_coord% = (x_coord% + x_offset%) * x_scale end if cursor_out$ = status_cursor$ pen_down_out$ = status_pen_down$ x_coord_out$ = format$(x_coord%,"########.") y_coord_out$ = format$(y_coord%,"########.") call vtpos(14%,12%,0%,7%) print using "########";x_coord% call vtpos(34%,12%,0%,7%) print using "########";y_coord% new_x = x_coord% new_y = y_coord% if first% then old_x = new_x old_y = new_y first_x = new_x first_y = new_y area = 0 first% = 0% length = 0 else if function_mode% = 2% then call compute_length(old_x,old_y,new_x,new_y,answer) total_length = total_length + answer old_x = new_x old_y = new_y call vtpos(52%,12%,0%,7%) print using "###,###,###"; total_length else area = area + ((new_x * old_y) - (old_x * new_y))/2 old_x = new_x old_y = new_y call vtpos(52%,12%,0%,7%) print using "###,###,###,###"; area end if end if if not reject% then array_pointer% = array_pointer% + 1 output_array$(array_pointer%) = talos_out$ output_array2$(array_pointer%) = var_out$ end if goto send_one_qio cancel_io_and_wake: i% = sys$cancel(chan1% by value) IF (i% AND 1%) = 0% THEN PRINT "ERROR IN SYS$cancel =";i% end if CALL SYS$WAKE(,) goto subroutine_end ! goto send_one_qio asterisk_pressed: ! This is the 'get your attention from the puck routine' !i% = sys$cancel(chan1% by value) !IF (i% AND 1%) = 0% THEN PRINT "ERROR IN SYS$cancel =";i% !end if call vtpos(6%,14%,0%,0%) print "Action required:" print tab(20);bold$;"F";normal$;"unction change" print tab(20);bold$;"T";normal$;"ext change for points" print tab(20);bold$;"B";normal$;"ase coordinate setting" print tab(20);bold$;"S";normal$;"cale setting" print tab(20);bold$;"A";normal$;"xis rotate" print tab(20);bold$;"H";normal$;"elp" call vtpos(1%,23%,2%,0%) input "Input action desired ";action$ first_let$ = seg$(action$,1%,1%) call str$upcase(first_let$,first_let$) if first_let$ = "F" then goto function_change else if first_let$ = "B" then goto set_base_coord else if first_let$ = "S" then goto set_scale else if first_let$ = "A" then goto axis_rotate else if first_let$ = "T" then goto text_change else if first_let$ = "H" then goto print_help else goto send_one_qio end if end if end if end if end if end if function_change: call vtpos(1%,23%,2%,0%) input "Enter then new function (Point, Area, Length) ";new_function$ call vtpos(14%,4%,0%,0%) call str$upcase(new_function$,new_function$) first_char$ = seg$(new_function$,1%,1%) if first_char$ = "P" then function_mode% = 0 else if first_char$ = "A" then function_mode% = 1 else if first_char$ = "L" then function_mode% = 2 end if end if end if call refresh_screen if function_mode% = 1 then goto send_multiple_qios else goto send_one_qio end if set_base_coord: call vtpos(1%,23%,2%,0%) input "Enter the base map x-origin ";map_x_origin% call vtpos(1%,23%,2%,0%) input "Enter the base map y-origin ";map_y_origin% call vtpos(1%,23%,2%,0%) print "Input the base coordinate point with the puck and press '#'" xy_pair% = 10% call send_ast_with_wait(1%) goto subroutine_end set_scale: call vtpos(1%,23%,2%,0%) input "Enter the x-scale ";x_scale call vtpos(1%,23%,2%,0%) input "Enter the y-scale ";y_scale if y_scale = 0 then y_scale = x_scale end if call refresh_screen goto send_one_qio axis_rotate: call vtpos(1%,23%,2%,0%) print "Input the left most x,y coordinate with the puck and press '#'" call send_ast_with_wait(1%) goto subroutine_end axis_rotate_2: call vtpos(1%,23%,2%,0%) print "Input the right most x,y coordinate with the puck and press '#'" call send_ast_with_wait(1%) goto subroutine_end pound_sign_pressed: if xy_pair% = 0% then goto point_1 else if xy_pair% = 10% then goto point_3 else goto point_2 end if end if point_1: xy_pair% = xy_pair% + 1% x_t_1$ = xlate(x_coord$,table$) y_t_1$ = xlate(y_coord$,table$) RET_STAT% = OTS$CVT_TZ_L(x_t_1$, x_c_1%) RET_STAT% = OTS$CVT_TZ_L(y_t_1$, y_c_1%) if xy_pair% < 2% then goto axis_rotate_2 end if point_2: x_t_2$ = xlate(x_coord$,table$) y_t_2$ = xlate(y_coord$,table$) RET_STAT% = OTS$CVT_TZ_L(x_t_2$, x_c_2%) RET_STAT% = OTS$CVT_TZ_L(y_t_2$, y_c_2%) if x_c_1% < x_c_2% then xtemp = x_c_2% - x_c_1% else call vtpos(1%,23%,2%,0%) print chr$(7) + "The leftmost x point was not entered " xy_pair% = 0% goto send_one_qio end if ytemp = y_c_2% - y_c_1% angle = ytemp/xtemp x_rotate_rad = atn(angle) x_rotate_deg = x_rotate_rad/(PI/180.) call vtpos(62%,10%,0%,7%) print using "###.####",x_rotate_deg xy_pair% = 0% call clear_to_end(15%) goto send_one_qio point_3: x_t_3$ = xlate(x_coord$,table$) y_t_3$ = xlate(y_coord$,table$) RET_STAT% = OTS$CVT_TZ_L(x_t_3$, x_origin%) RET_STAT% = OTS$CVT_TZ_L(y_t_3$, y_origin%) x_offset% = map_x_origin% - x_origin% y_offset% = map_y_origin% - y_origin% call refresh_screen xy_pair% = 0% goto send_one_qio text_change: call vtpos(1%,23%,2%,0%) input "Input the new text ";var_out$ call vtpos(35%, 5%, 2%, 7%) print trm$(var_out$); goto send_one_qio left_xy_coord: right_xy_coord: print_help: call vtpos(1%, 23%, 2%, 0%) input "No help is available at this time. Press RETURN to continue.";a$ goto send_one_qio send_multiple_qios: call send_digitizer_ast(1%) call send_digitizer_ast(2%) call send_digitizer_ast(3%) call send_digitizer_ast(3%) call send_digitizer_ast(4%) call send_digitizer_ast(5%) goto subroutine_end send_one_qio: call send_digitizer_ast(N%) subroutine_end: call clear_to_end(13%) 900 SUBEND 1000 sub mode_print(function_mode%) ! function_mode = 0, point ! function_mode = 1, area ! function_mode = 2, length reverse$ = chr$(27%) + "[7m" normal$ = chr$(27%) + "[0m" call vtpos(14%,4%,0%,7%) if function_mode% = 0 then & print "POINT";normal$;" " & else & if function_mode% = 1 then & print "AREA";normal$;" " & else if function_mode% = 2 then & print "LENGTH";normal$ end if end if end if 1020 subend 1030 sub clear_to_end(line%) print chr$(27) + "[0m" ; print chr$(27) + "[" + num1$(line%) + ";1f" ; print chr$(27) + "[0J"; 1040 subend 1050 sub compute_length(x1,y1,x2,y2,answer) %include "digitcom.bas" answer = sqr((y2-y1)**2 + (x2-x1)**2) 1060 subend 1070 sub rotate %include "digitcom.bas" x1 = map_x_origin% x = (x_coord% + x_offset%) y1 = map_y_origin% y = (y_coord% + y_offset%) x_coord% = ((X-X1)*COS(x_rotate_rad) + (Y-Y1)*SIN(x_rotate_rad))*x_scale y_coord% = (-(X-X1)*SIN (x_rotate_rad) + (Y-Y1)*COS(x_rotate_rad))*y_scale x_coord% = x_coord% + map_x_origin% y_coord% = y_coord% + map_y_origin% 1080 subend