!This file is part of VEL_demo, copyright David Keyes, 2007. ! !This source file is free software: you can redistribute it and/or modify !it under the terms of the GNU General Public License as published by !the Free Software Foundation, either version 3 of the License, or !(at your option) any later version. ! !This code 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 General Public License for more details. ! !For terms of the GNU General Public license see . GLOBAL DRAWING MODULE dim_vline( VECTOR p1 > "start pos"; VECTOR p2 > "end pos"; FLOAT offset:=10.0 > "offset"; INT arr_slash:=0 > "0=slash, 1=arrow"; VAR FLOAT d_inch); FLOAT pos; FLOAT t_off, t_sizeA, t_sizeB, t_width, slash_len, dim_ext, dim_off; INT scale, pen_col; BEGINMODULE part(#1, dim_vars(scale, pen_col, t_off, t_sizeA, t_sizeB, t_width, slash_len, dim_ext, dim_off)); set(PEN=pen_col); pos:=p1.x + offset; lin_free(#10,p1, p2:BLANK=1); IF p1.x > pos THEN dim_off:=-dim_off; dim_ext:=-dim_ext; ENDIF; lin_free(#11,vec(p1.x + dim_off, p1.y ), vec( pos + dim_ext, p1.y)); dim_ext:=abs(dim_ext); dim_off:=abs(dim_off); IF p2.x > pos THEN dim_off:=-dim_off; dim_ext:=-dim_ext; ENDIF; lin_free(#12,vec(p2.x + dim_off , p2.y), vec( pos + dim_ext, p2.y)); lin_free(#13,vec(pos, p1.y), vec( pos, p2.y)); csys_1p(#15,"a", intersect(#13, #11, -1), 0.0, 0.0, 90.0:BLANK=1); csys_1p(#16,"b", intersect(#13, #12, -1), 0.0, 0.0, -90.0:BLANK=1); IF arr_slash = 0 THEN part(#17, slash(slash_len),#15); part(#18, slash(slash_len),#16); ELSE part(#19, arrow(slash_len*0.5),#15); part(#20, arrow(slash_len*0.5),#16); ENDIF; d_inch:=p2.y - p1.y; ENDMODULE