0001 function drawArrowhead(point,dir,rad,color)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 global mapHandle
0013 global CB_MAP_OUTPUT
0014 angle = atan2(dir(2),dir(1));
0015 l = rad*.9;
0016 spread = pi/6*.9;
0017 x = [(point(1)+l*cos(angle+spread)) point(1) (point(1)+l*cos(angle-spread))];
0018 y = [(point(2)+l*sin(angle+spread)) point(2) (point(2)+l*sin(angle-spread))];
0019 if strcmp(CB_MAP_OUTPUT, 'matlab')
0020 if find(color>1)
0021 color = color/255;
0022 end
0023 fill(x,-y,color);
0024 elseif strcmp(CB_MAP_OUTPUT, 'java')
0025
0026 elseif strcmp(CB_MAP_OUTPUT, 'svg')
0027
0028 if ischar(color)
0029 colorFill = color;
0030 else if isvector(color)
0031 colorFill = strcat('rgb(',num2str(color(1)),',',num2str(color(2)), ',',num2str(color(3)),')');
0032 end
0033 end
0034 colorStroke = colorFill;
0035 fprintf(mapHandle,'<path d="M %8.2f %8.2f L %8.2f %8.2f L %8.2f %8.2f z" fill="%s" stroke="%s"/>\n',x(1),y(1),x(2),y(2),x(3),y(3),colorFill,colorStroke);
0036 else
0037 display('no render found');
0038 end
0039 end