]> Creatis software - creaWT.git/blob - wt/bbtk_wt_PKG/src/bbwtSphereXTK.cxx
bugs wt xtk
[creaWT.git] / wt / bbtk_wt_PKG / src / bbwtSphereXTK.cxx
1 //===== 
2 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
3 //===== 
4 #include "bbwtSphereXTK.h"
5 #include "bbwtPackage.h"
6
7 #include<Wt/WApplication>
8
9
10 namespace bbwt
11 {
12
13 BBTK_ADD_BLACK_BOX_TO_PACKAGE(wt,SphereXTK)
14 BBTK_BLACK_BOX_IMPLEMENTATION(SphereXTK,bbtk::AtomicBlackBox);
15 //===== 
16 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
17 //===== 
18 void SphereXTK::Process()
19 {
20
21 // THE MAIN PROCESSING METHOD BODY
22 //   Here we simply set the input 'In' value to the output 'Out'
23 //   And print out the output value
24 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
25 //    void bbSet{Input|Output}NAME(const TYPE&)
26 //    const TYPE& bbGet{Input|Output}NAME() const 
27 //    Where :
28 //    * NAME is the name of the input/output
29 //      (the one provided in the attribute 'name' of the tag 'input')
30 //    * TYPE is the C++ type of the input/output
31 //      (the one provided in the attribute 'type' of the tag 'input')
32
33
34      Wt::WContainerWidget* w = (Wt::WContainerWidget*)bbGetInputViewerWTxtk();
35      std::string strRadio =  boost::lexical_cast<std::string>( bbGetInputRadio() );
36      std::string jsCom ;
37
38
39
40     if (firsttime==true)
41 {
42         firsttime=false;
43          jsCom = "\
44  alert('Creating sphere');\
45   var sphere = new X.sphere(); \
46   sphere.radius = "+strRadio+"; \
47   sphere.center = [50, 50, 50]; \
48   sphere.color = [0, 1, 0]; \
49   sphere.caption = 'a sphere'; \
50   "+ w->jsRef() + ".sphere = sphere ;\
51   "+ w->jsRef() + ".mRenderer.add("+ w->jsRef() + ".sphere);\
52   "+ w->jsRef() + ".mRenderer.render();\
53   ";
54   } else {
55          jsCom = "\
56   "+ w->jsRef() + ".sphere.radius = "+strRadio+"; \
57   "+ w->jsRef() + ".mRenderer.add("+ w->jsRef() + ".sphere);\
58  "+ w->jsRef() + ".mRenderer.render();\
59   ";
60
61 }
62         
63  
64      Wt::WApplication::instance()->doJavaScript(jsCom);
65
66   
67 }
68 //===== 
69 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
70 //===== 
71 void SphereXTK::bbUserSetDefaultValues()
72 {
73
74 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
75 //    Here we initialize the input 'In' to 0
76
77    std::vector<double> center;
78    center.push_back(0);
79    center.push_back(0);
80    center.push_back(0);
81
82    firsttime=true;
83    bbSetInputViewerWTxtk(NULL);
84    bbSetInputCenter(center);
85    bbSetInputRadio(10);
86   
87 }
88 //===== 
89 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
90 //===== 
91 void SphereXTK::bbUserInitializeProcessing()
92 {
93
94 //  THE INITIALIZATION METHOD BODY :
95 //    Here does nothing 
96 //    but this is where you should allocate the internal/output pointers 
97 //    if any 
98
99   
100 }
101 //===== 
102 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
103 //===== 
104 void SphereXTK::bbUserFinalizeProcessing()
105 {
106
107 //  THE FINALIZATION METHOD BODY :
108 //    Here does nothing 
109 //    but this is where you should desallocate the internal/output pointers 
110 //    if any
111   
112 }
113 }
114 // EO namespace bbwt
115
116