Messages standardization
[scilab.git] / scilab / modules / compatibility_functions / macros / mtlb_axis.sci
1 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2 // Copyright (C) 2002-2004 - INRIA - Vincent COUVERT 
3 // 
4 // This file must be used under the terms of the CeCILL.
5 // This source file is licensed as described in the file COPYING, which
6 // you should have received as part of this distribution.  The terms
7 // are also available at    
8 // http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
9
10 function varargout=mtlb_axis(varargin)
11 // Emulation function for Matlab axis()
12
13 varargout(1)=list()
14 listvar=varargin
15 if size(listvar)==0
16   a=gca();
17   set(gca(),"axes_visible",'on')
18   varargout(1)=matrix(a.data_bounds,1,-1);
19   return
20 elseif type(listvar(1))<>9 then
21   a=gca();
22   rhs=lstsize(listvar)
23 else
24   a=listvar(1)
25   listvar(1)=null()
26   rhs=lstsize(listvar)
27   listvar=listvar
28 end
29
30 if rhs>0 then
31   for krhs=1:rhs
32     if type(listvar(krhs))==1 then
33         if size(listvar(krhs),1)>1 & size(listvar(krhs),2)>1 then
34           error(msprintf(gettext("%s: Wrong size for ''%s'': Vector expected.\n"),"mtlb_axis","data_bounds"));
35         end
36         listvar(krhs) = matrix(listvar(krhs),1,-1);
37         
38       // axis([xmin xmax ymin ymax zmin zmax])
39       if size(listvar(krhs),2)==4 then
40         set(gca(),"data_bounds",matrix(listvar(krhs),2,-1))
41               set(gca(),"view",'2d')
42               set(gca(),"axes_visible",'on')
43       elseif size(listvar(krhs),2)==6
44               set(gca(),"data_bounds",matrix(listvar(krhs),2,-1))
45               set(gca(),"view",'3d')
46               set(gca(),"axes_visible",'on')
47       // axis([xmin xmax ymin ymax zmin zmax cmin cmax]) 
48       elseif size(listvar(krhs),2)==8 then
49         error(msprintf(gettext("%s: This feature has not been implemented: %s.\n"),"mtlb_axis", "data_bounds=[xmin xmax ymin ymax zmin zmax cmin cmax]"));
50       // Unknown column number for listvar(krhs)
51       else
52         error(msprintf(gettext("%s: Wrong value for affectation to ''%s''.\n"),"mtlb_axis", "data_bounds"));
53       end
54       
55     elseif type(listvar(krhs))==10 then
56         
57       // axis auto
58       if listvar(krhs)=="auto" then
59         a.auto_scale="on"
60         
61         // axis manual
62       elseif listvar(krhs)=="manual" then
63         a.auto_scale="off"
64         
65         // axis tight
66       elseif listvar(krhs)=="tight" then
67         a.tight_limits="on"
68         
69         // axis fill
70       elseif listvar(krhs)=="fill" then
71         error(msprintf(gettext("%s: This feature has not been implemented: %s.\n"),"mtlb_axis", "axis fill"));
72
73         // axis ij
74       elseif listvar(krhs)=="ij" then
75         a.rotation_angles=[180 270]
76         
77         // axis xy
78       elseif listvar(krhs)=="xy" then
79         a.rotation_angles=[0 270]
80         
81         // axis equal
82       elseif listvar(krhs)=="equal" then
83         a.isoview="on"
84         
85             // axis image
86       elseif listvar(krhs)=="image" then
87         error(msprintf(gettext("%s: This feature has not been implemented: %s.\n"),"mtlb_axis","axis image"));
88
89         // axis square
90       elseif listvar(krhs)=="square" then
91               if a.view=="2d" then
92                 warning(msprintf(gettext("%s: ''%s'' only used in 3d mode."),"mtlb_axis","cube_scaling"));
93               end
94               a.cube_scaling="on"
95         
96         // axis vis3d
97       elseif listvar(krhs)=="vis3d" then
98         a.view="3d"
99         
100         // axis normal
101       elseif listvar(krhs)=="normal" then
102         error(msprintf(gettext("%s: This feature has not been implemented: %s.\n"),"mtlb_axis","axis normal"));
103         
104         // axis on
105       elseif listvar(krhs)=="on" then
106         a.axes_visible="on"
107         
108         // axis off
109       elseif listvar(krhs)=="off" then
110         a.axes_visible="off"
111         
112         // [mode,visibility,direction] = axis('state')
113       elseif listvar(krhs)=="state" then
114         if a.auto_scale=="on" then
115           varargout(1)="auto"
116               else
117           varargout(1)="manual"
118         end
119         varargout(2)=a.axes_visible
120         if a.rotation_angles==[0 180] then
121           varargout(3)="xy"
122         else
123                 varargout(3)="ij"
124         end
125         // Unknown character string
126       else
127         error(msprintf(gettext("%s: This feature has not been implemented: %s.\n"),"mtlb_axis","axis "+listvar(krhs)));
128       end
129       
130     // axis(axes_handles,...)
131     elseif type(listvar(krhs))==9 then
132       // krhs must be one
133       for khandle=1:lstsize(listvar(krhs))
134         arglist=list()
135         for kvararg=1:lstsize(listvar)-1
136           arglist($+1)=listvar(kvararg+1)
137         end
138         arglist($+1)=listvar(krhs)(khandle)
139         mtlb_axis(arglist)
140       end
141     // Wrong type for listvar(krhs)
142     else
143         error(msprintf(gettext("%s: This feature has not been implemented: Argument of type %d.\n"),"mtlb_axis",type(listvar(krhs))));
144     end
145       varargout(1)=matrix(a.data_bounds,1,-1);
146   end
147
148 // v = axis
149 else
150   varargout(1)=matrix(a.data_bounds,1,-1);
151 end
152 endfunction