* Bug 16320 fixed: typos in blocks interfaces + a few files
[scilab.git] / scilab / modules / scicos_blocks / macros / Sinks / CANIMXY3D.sci
1 //  Scicos
2 //
3 //  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 //
19 // See the file ../license.txt
20 //
21
22 function [x,y,typ]=CANIMXY3D(job,arg1,arg2)
23     //Scicos 3D animated visualization block
24     x=[];
25     y=[];
26     typ=[];
27     select job
28     case "set" then
29         x=arg1;
30         graphics=arg1.graphics;
31         exprs=graphics.exprs
32         model=arg1.model;
33         while %t do
34             [ok,nbr_curves,clrs,siz,win,wpos,wdim,vec_x,vec_y,vec_z,param3ds,N,exprs]=scicos_getvalue(..
35             msprintf(_("Set %s block parameters"), "CANIMXY3D Scope"),..
36              [_("Number of curves");
37               _("Curves styles: Colors>0 | marks<0");
38               _("Curves thicknesses or marks sizes");
39               _("Output window number (-1 for automatic)");
40               _("Output window position");
41               _("Output window sizes");
42                 "Xmin, Xmax";
43                 "Ymin, Ymax";
44                 "Zmin, Zmax";
45                 "Alpha, Theta";
46               _("Buffer size")],..
47             list("vec",1,"vec",-1,"vec",-1,"vec",1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",1),exprs)
48             if ~ok then
49                 break,
50             end //user cancel modification
51             mess = []
52             if size(wpos,"*")<>0 &size(wpos,"*")<>2 then
53                 mess=[mess ; _("''Window position'' must be [] or a 2 vector") ; " "]
54             end
55             if size(wdim,"*")<>0 &size(wdim,"*")<>2 then
56                 mess=[mess ; _("''Window sizes'' must be [] or a 2 vector") ; " "]
57             end
58             if win<-1 then
59                 mess=[mess ; _("The Window number must be >= -1") ; " "]
60             end
61             if size(clrs,"*")<>size(siz,"*") then
62                 mess=[mess ; _("The numbers of curves styles and of<br>curves thickness or marks size must match.") ; " "]
63             end
64             if nbr_curves<=0 then
65                 mess=[mess ; _("The Number of curves must be >= 1") ; " "]
66             end
67             if size(clrs,"*")<nbr_curves then
68                 msg = _("Not enough curves styles: At least %d expected.")
69                 mess=[mess ; msprintf(msg, nbr_curves) ; " "]
70             end
71             if N<1 then
72                 mess=[mess ; _("The Buffer size must be >= 1") ; " "]
73             end
74             if N<2
75                 for i=1:nbr_curves
76                     if clrs(i)>0 then
77                         mess=[mess;
78                         _("The Buffer size must be >= 2, or Change a color (must be <0)");
79                         " "]
80                     end
81                 end
82             end
83             if vec_y(1)>=vec_y(2) then
84                 mess=[mess _("Ymax > Ymin is required") ; " "]
85             end
86             if vec_x(1)>=vec_x(2) then
87                 mess=[mess ; _("Xmax > Xmin is required") ; " "]
88             end
89             if vec_z(1)>=vec_z(2) then
90                 mess=[mess ; _("Zmax > Zmin is required") ; " "]
91             end
92             //
93             if mess <> [] then
94                 message(mess)
95             else
96                 in = nbr_curves*ones(3,1);
97                 in2 = ones(3,1);
98                 [model,graphics,ok]=set_io(model,graphics,list([in in2],ones(3,1)),list(),ones(1,1),[]);
99                 if wpos==[] then
100                     wpos=[-1;-1];
101                 end
102                 if wdim==[] then
103                     wdim=[-1;-1];
104                 end
105                 rpar=[vec_x(:);vec_y(:);vec_z(:);param3ds(:)]
106                 size_siz = size(siz,"*");
107                 ipar=[win;size_siz;N;clrs(:);siz(:);1;wpos(:);wdim(:);nbr_curves]
108                 model.rpar=rpar;
109                 model.ipar=ipar
110                 graphics.exprs=exprs;
111                 x.graphics=graphics;
112                 x.model=model
113                 break
114             end
115         end
116
117     case "define" then
118         win=-1;
119         N=2;
120         clrs = [1;2;3;4;5;6;7;13]
121         siz = [1;1;1;1;1;1;1;1]
122         wpos=[-1;-1];
123         wdim=[-1;-1];
124         param3ds=[50;280]
125         vec_x = [-15;15]
126         vec_y = [-15;15]
127         vec_z = [-15;15]
128         nbr_curves = 1;
129
130         model=scicos_model()
131         model.sim=list("canimxy3d",4)
132         model.in=[1;1;1]
133         model.evtin=1
134         model.in2=[1;1;1]
135         model.intyp=[1;1;1]
136         model.rpar=[vec_x(:);vec_y(:);vec_z(:);param3ds(:)]
137         model.ipar=[win;8;N;clrs(:);siz(:);8;wpos(:);wdim(:);nbr_curves]
138         model.blocktype="d"
139         model.firing=[]
140         model.dep_ut=[%f %f]
141
142         exprs=[string(nbr_curves);
143         strcat(string(clrs)," ");
144         strcat(string(siz)," ");
145         string(win);
146         "[]";
147         "[]";
148         strcat(string(vec_x)," ");
149         strcat(string(vec_y)," ");
150         strcat(string(vec_z)," ");
151         strcat(string(param3ds)," ");
152         string(N)]
153         gr_i=[]
154         x=standard_define([2 2],model,exprs,gr_i)
155     end
156 endfunction