drawCircle

PURPOSE ^

drawCircle draw a circle in a figure

SYNOPSIS ^

function drawCircle(p,radius,color)

DESCRIPTION ^

drawCircle draw a circle in a figure

 drawCircle(p,radius,color)

INPUTS
 p             Coordinates
 radius        Radius of the circle
 color         Color of the circle

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function drawCircle(p,radius,color)
0002 %drawCircle draw a circle in a figure
0003 %
0004 % drawCircle(p,radius,color)
0005 %
0006 %INPUTS
0007 % p             Coordinates
0008 % radius        Radius of the circle
0009 % color         Color of the circle
0010 %
0011 %
0012 global CB_MAP_OUTPUT
0013 global mapHandle
0014 %p = center
0015 %radius = radius
0016 %color
0017 
0018 
0019 if strcmp(CB_MAP_OUTPUT, 'matlab')
0020     i = 0:pi/100:2*pi;
0021     x = radius*cos(i)+p(1);
0022     y = radius*sin(i)-p(2);
0023     if find(color>1)
0024         color = color/255;
0025     end
0026     fill(x,y,color);
0027 elseif strcmp(CB_MAP_OUTPUT, 'java')
0028     %draw circle via java.
0029     % center = p; radius = radius
0030     setDataCircle(mapHandle,p(1,1),p(2,1));
0031 elseif strcmp(CB_MAP_OUTPUT, 'svg')
0032     met = strcat('<g id="',...
0033         'x',...
0034         '" style="fill: rgb(',...
0035         num2str(color(1)),', ',...
0036         num2str(color(2)),', ',...
0037         num2str(color(3)),');">\n<circle cx="',...
0038         num2str(p(1)),'" cy="',...
0039         num2str(p(2)),...
0040         '" r="',num2str(radius),...
0041         '"/>\n</g>\n');
0042     fprintf(mapHandle, met);
0043 %         met = strcat('<g id="',...
0044 %         'x',...
0045 %         '" style="fill: rgb(255, 160, 128); stroke: rgb(64, 0, 0); stroke-width: 1;">\n<circle cx="',...
0046 %         num2str(p(1)),'" cy="',...
0047 %         num2str(-p(2)),...
0048 %         '" r="',num2str(radius),...
0049 %         '"/>\n</g>\n');
0050 %     fprintf(mapHandle, met);
0051 else
0052     display('error');
0053 end

Generated on Thu 21-Jun-2012 15:39:23 by m2html © 2003