localization (compatibility_functions module)
[scilab.git] / scilab / modules / compatibility_functions / macros / mtlb_axis.sci
1 function varargout=mtlb_axis(varargin)
2 // Copyright INRIA
3 // Emulation function for Matlab axis()
4 // V.C.
5
6 varargout(1)=list()
7 listvar=varargin
8 if size(listvar)==0
9   a=gca();
10   set(gca(),"axes_visible",'on')
11   varargout(1)=matrix(a.data_bounds,1,-1);
12   return
13 elseif type(listvar(1))<>9 then
14   a=gca();
15   rhs=lstsize(listvar)
16 else
17   a=listvar(1)
18   listvar(1)=null()
19   rhs=lstsize(listvar)
20   listvar=listvar
21 end
22
23 if rhs>0 then
24   for krhs=1:rhs
25     if type(listvar(krhs))==1 then
26         if size(listvar(krhs),1)>1 & size(listvar(krhs),2)>1 then
27           error(gettext("errors","compatibility_functions_error_30"));
28         end
29         listvar(krhs) = matrix(listvar(krhs),1,-1);
30         
31       // axis([xmin xmax ymin ymax zmin zmax])
32       if size(listvar(krhs),2)==4 then
33         set(gca(),"data_bounds",matrix(listvar(krhs),2,-1))
34         set(gca(),"view",'2d')
35         set(gca(),"axes_visible",'on')
36       elseif size(listvar(krhs),2)==6
37         set(gca(),"data_bounds",matrix(listvar(krhs),2,-1))
38         set(gca(),"view",'3d')
39         set(gca(),"axes_visible",'on')
40       // axis([xmin xmax ymin ymax zmin zmax cmin cmax]) 
41       elseif size(listvar(krhs),2)==8 then
42         error(gettext("errors","compatibility_functions_error_31"));
43       // Unknown column number for listvar(krhs)
44       else
45         error(gettext("errors","compatibility_functions_error_32"));
46       end
47       
48     elseif type(listvar(krhs))==10 then
49         
50       // axis auto
51       if listvar(krhs)=="auto" then
52         a.auto_scale="on"
53         
54         // axis manual
55       elseif listvar(krhs)=="manual" then
56         a.auto_scale="off"
57         
58         // axis tight
59       elseif listvar(krhs)=="tight" then
60         a.tight_limits="on"
61         
62         // axis fill
63       elseif listvar(krhs)=="fill" then
64         error(gettext("errors","compatibility_functions_error_33"));
65
66         // axis ij
67       elseif listvar(krhs)=="ij" then
68         a.rotation_angles=[180 270]
69         
70         // axis xy
71       elseif listvar(krhs)=="xy" then
72         a.rotation_angles=[0 270]
73         
74         // axis equal
75       elseif listvar(krhs)=="equal" then
76         a.isoview="on"
77         
78         // axis image
79       elseif listvar(krhs)=="image" then
80         error(gettext("errors","compatibility_functions_error_34"));
81
82         // axis square
83       elseif listvar(krhs)=="square" then
84         if a.view=="2d" then
85           warning(gettext("messages","compatibility_functions_message_4"));
86         end
87         a.cube_scaling="on"
88         
89         // axis vis3d
90       elseif listvar(krhs)=="vis3d" then
91         a.view="3d"
92         
93         // axis normal
94       elseif listvar(krhs)=="normal" then
95         error(gettext("errors","compatibility_functions_error_35"));
96         
97         // axis on
98       elseif listvar(krhs)=="on" then
99         a.axes_visible="on"
100         
101         // axis off
102       elseif listvar(krhs)=="off" then
103         a.axes_visible="off"
104         
105         // [mode,visibility,direction] = axis('state')
106       elseif listvar(krhs)=="state" then
107         if a.auto_scale=="on" then
108           varargout(1)="auto"
109         else
110           varargout(1)="manual"
111         end
112         varargout(2)=a.axes_visible
113         if a.rotation_angles==[0 180] then
114           varargout(3)="xy"
115         else
116           varargout(3)="ij"
117         end
118         // Unknown character string
119       else
120         error(msprintf(gettext("errors","compatibility_functions_error_36"),listvar(krhs)));
121       end
122       
123     // axis(axes_handles,...)
124     elseif type(listvar(krhs))==9 then
125       // krhs must be one
126       for khandle=1:lstsize(listvar(krhs))
127         arglist=list()
128         for kvararg=1:lstsize(listvar)-1
129           arglist($+1)=listvar(kvararg+1)
130         end
131         arglist($+1)=listvar(krhs)(khandle)
132         mtlb_axis(arglist)
133       end
134     // Wrong type for listvar(krhs)
135     else
136         error(msprintf(gettext("errors","compatibility_functions_error_37"),type(listvar(krhs))));
137     end
138     varargout(1)=matrix(a.data_bounds,1,-1);
139   end
140
141 // v = axis
142 else
143   varargout(1)=matrix(a.data_bounds,1,-1);
144 end
145 endfunction