1 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2 // Copyright (C) 2002-2004 - INRIA - Vincent COUVERT
4 // Copyright (C) 2012 - 2016 - Scilab Enterprises
6 // This file is hereby licensed under the terms of the GNU GPL v2.0,
7 // pursuant to article 5.3.4 of the CeCILL v.2.1.
8 // This file was originally licensed under the terms of the CeCILL v2.1,
9 // and continues to be available under such terms.
10 // For more information, see the COPYING file which you should have received
11 // along with this program.
13 function tree=sci_axis(tree)
15 // Conversion function for Matlab axis()
16 // Input: tree = Matlab funcall tree
17 // Ouput: tree = Scilab equivalent for tree
20 a=Funcall("gca",1,list(),list())
24 if tree.rhs(krhs).vtype==Double then
26 // axis([xmin xmax ymin ymax])
27 // axis([xmin xmax ymin ymax zmin zmax])
28 if or(tree.rhs(krhs).dims(2)==[4,6]) then
29 mat=Funcall("matrix",1,list(tree.rhs(krhs),Cste(2),Cste(-1)),list())
30 tree=Funcall("set",1,Rhs_tlist(a,"data_bounds",mat),tree.lhs)
32 // axis([xmin xmax ymin ymax zmin zmax cmin cmax])
33 elseif tree.rhs(krhs).dims(2)==8 then
34 no_equiv(expression2code(tree))
36 // Unknown column number for tree.rhs(krhs)
40 elseif tree.rhs(krhs).vtype==String then
42 // Option is a character string
43 if typeof(tree.rhs(krhs))=="cste" then
46 if tree.rhs(krhs).value=="auto" then
47 tree=Funcall("set",1,Rhs_tlist(a,"auto_scale","on"),tree.lhs)
50 elseif tree.rhs(krhs).value=="manual" then
51 tree=Funcall("set",1,Rhs_tlist(a,"auto_scale","off"),tree.lhs)
54 elseif tree.rhs(krhs).value=="tight" then
55 tree=Funcall("set",1,Rhs_tlist(a,"tight_limits","on"),tree.lhs)
58 elseif tree.rhs(krhs).value=="fill" then
59 no_equiv(expression2code(tree))
62 elseif tree.rhs(krhs).value=="ij" then
63 mat=Operation("cc",list(Cste(180),Cste(270)),list())
64 tree=Funcall("set",1,Rhs_tlist(a,"rotation_angles",mat),tree.lhs)
67 elseif tree.rhs(krhs).value=="xy" then
68 mat=Operation("cc",list(Cste(0),Cste(270)),list())
69 tree=Funcall("set",1,Rhs_tlist(a,"rotation_angles",mat),tree.lhs)
72 elseif tree.rhs(krhs).value=="equal" then
73 tree=Funcall("set",1,Rhs_tlist(a,"isoview","on"),tree.lhs)
76 elseif tree.rhs(krhs).value=="image" then
77 no_equiv(expression2code(tree))
80 elseif tree.rhs(krhs).value=="square" then
81 set_infos(gettext("cube_scaling only used in 3d mode."),2);
82 tree=Funcall("set",1,Rhs_tlist(a,"cube_scaling","on"),tree.lhs)
85 elseif tree.rhs(krhs).value=="vis3d" then
86 tree=Funcall("set",1,Rhs_tlist(a,"view","3d"),tree.lhs)
89 elseif tree.rhs(krhs).value=="normal" then
90 no_equiv(expression2code(tree))
93 elseif tree.rhs(krhs).value=="on" then
94 tree=Funcall("set",1,Rhs_tlist(a,"axes_visible","on"),tree.lhs)
97 elseif tree.rhs(krhs).value=="off" then
98 tree=Funcall("set",1,Rhs_tlist(a,"axes_visible","off"),tree.lhs)
100 // [mode,visibility,direction] = axis('state')
101 elseif tree.rhs(krhs).value=="state" then
102 tree.name="mtlb_axis"
104 // Unknown character string
106 tree.name="mtlb_axis"
109 // Option is a variable
111 tree.name="mtlb_axis"
114 // axis(axes_handles,...)
115 elseif tree.rhs(krhs).vtype==Handle then
116 no_equiv(expression2code(tree))
118 // Unknown type for tree.rhs(krhs)
120 tree.name="mtlb_axis"
125 tree=Funcall("set",1,Rhs_tlist(a,"data_bounds"),tree.lhs)
126 tree.lhs(1).dims=list(2,Unknown)
127 tree.lhs(1).type=Type(Double,Real)