]> Creatis software - bbtk.git/commitdiff
Clean code
authoreduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Wed, 18 Sep 2024 15:03:11 +0000 (17:03 +0200)
committereduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Wed, 18 Sep 2024 15:03:11 +0000 (17:03 +0200)
kernel/src/bbtkInterpreterPython.cxx
packages/std/src/bbstdDiv.xml
packages/std/src/bbstdReadLinesString.h
packages/std/src/bbstdReplaceCleanString.h
packages/std/src/bbstdVectorFilterDouble.cxx
packages/std/src/bbstdVectorFilterDouble.h
packages/wx/src/bbwxCheckBox.h
packages/wx/src/bbwxComboBox.h

index e47966f702ddb1b47bd749a2db731752291dcd1a..d5ce12a44a78278f70d1c0cbf8b85c15d8d729ca 100644 (file)
@@ -73,9 +73,9 @@ namespace bbtk
   {
       int pos = boxType.find( std::string(":") );
       std::string boxTypeTmp=boxType;
-      boxTypeTmp.replace(pos,1,"_");
+      boxTypeTmp.replace(pos,1,".");
       // ex:   mCB.New( bbtkBlackBox.std_ConcatString("Box10") )
-      std::string  code("        self.New( "+boxTypeTmp+"('"+boxName+"') )");
+      std::string  code("        self.New( bbtk.bb"+boxTypeTmp+"('"+boxName+"') )");
       this->pythonBBTK.push_back(code);
   }
   //=========================================================================
@@ -123,9 +123,15 @@ namespace bbtk
   void InterpreterPython::commandDefine(const std::string &name,const std::string &pack,const std::string &scriptfilename) // virtual
   {
       this->pythonBBTK.push_back(" ");
-      this->pythonBBTK.push_back("from bbtk.bbtkBlackBox import *");
+      
+//EED2024-07-29
+//      this->pythonBBTK.push_back("from bbtk.bbtkBlackBox import *");
+//      this->pythonBBTK.push_back(" ");
+//      this->pythonBBTK.push_back("class "+pack+"_"+name+"(ComplexBlackBox):");
+      this->pythonBBTK.push_back("import bbtk.bbtk as bbtk");
       this->pythonBBTK.push_back(" ");
-      this->pythonBBTK.push_back("class "+pack+"_"+name+"(ComplexBlackBox):");
+      this->pythonBBTK.push_back("class "+name+"(bbtk.bbkernel.ComplexBlackBox):");
+      
       this->pythonBBTK.push_back(" ");
       this->pythonBBTK.push_back("    def __init__(self, nameBox):");
       this->pythonBBTK.push_back("        super().__init__(nameBox)");
index 6bc651c2e557f6fe9e7e12138fb9e4ec0a9903bf..5f2f72151bab0d16ae5cc31c08640740dd82c507 100644 (file)
@@ -3,7 +3,7 @@
 <blackbox name="Div">
 
   <author>laurent.guigues@creatis.insa-lyon.fr</author>
-  <description>(C++,Python) Divides its inputs</description>
+  <description>(C++,Python,JavaScript) Divides its inputs</description>
   <category>math</category>
 
   <input name="In1"  type="double" description="Numerator"/>
index 2b8c32be500105effa5032142183191cdf0f2dee..25fc72c620ba2a77cfd7c163cf5a2aef3ae1d257 100644 (file)
@@ -30,7 +30,7 @@ class bbstd_EXPORT ReadLinesString
 BBTK_BEGIN_DESCRIBE_BLACK_BOX(ReadLinesString,bbtk::AtomicBlackBox);
   BBTK_NAME("ReadLinesString");
   BBTK_AUTHOR("Info-Dev");
-  BBTK_DESCRIPTION("No Description.");
+  BBTK_DESCRIPTION("(C++,JavaScipt) No Description.");
   BBTK_CATEGORY("empty");
  
   BBTK_INPUT(ReadLinesString,FileName,"FileName",std::string,"");
index ebd2718c49d055f7ab2f2637aabf9e21d4bba191..84a57747670a0f36d8edf7f90972d096669c340e 100644 (file)
@@ -33,7 +33,7 @@ class bbstd_EXPORT ReplaceCleanString
 BBTK_BEGIN_DESCRIBE_BLACK_BOX(ReplaceCleanString,bbtk::AtomicBlackBox);
  BBTK_NAME("ReplaceCleanString");
  BBTK_AUTHOR("InfoDev");
- BBTK_DESCRIPTION("(C++,Python) No Description.");
+ BBTK_DESCRIPTION("(C++,Python,JavaScript) No Description.");
  BBTK_CATEGORY("empty");
  BBTK_INPUT(ReplaceCleanString,In,"Input string",std::string,"");
  BBTK_INPUT(ReplaceCleanString,Replace,"New string to be put",std::string,"");
index c132e918a19f4bdf67b98d34977c885849eeb50b..1ef07bc30a3d852be3c611823c52cd1dee149c6a 100644 (file)
@@ -466,6 +466,30 @@ void VectorFilterDouble::Process()
                 } // for iSeg
             } // if k1 not empty
         }
+     } // Type 14
+    if (bbGetInputType()==15)   // 15 swhitch element in a point k1=0 yz, k1=1 nothing k2=2 xz
+    {
+        double x,y,z;
+        double xx,yy,zz;
+        std::vector<double> k1 =bbGetInputk1();
+        if ( (In0.size()==3) && (k1.size()==1 ) )
+        {
+            if (k1[0]==0) {
+                Out0.push_back( In0[0] );  // x
+                Out0.push_back( In0[2] );  // z
+                Out0.push_back( In0[1] );  // y
+            }
+            if (k1[1]==1) {
+                Out0.push_back( In0[0] );  // x
+                Out0.push_back( In0[1] );  // y
+                Out0.push_back( In0[2] );  // z
+            }
+            if (k1[2]==2) {
+                Out0.push_back( In0[2] );  // z
+                Out0.push_back( In0[1] );  // y
+                Out0.push_back( In0[0] );  // x
+            }
+        } // if In0.size   and  k1.size
      } // Type 14
 
        bbSetOutputOut0( Out0 );
index c9d9438eb255b738f4c6493049206db66c9ef6dc..08b525fc8e408d0bd0b79f9ada91a2949c5da869 100644 (file)
@@ -52,8 +52,8 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(VectorFilterDouble,bbtk::AtomicBlackBox);
   BBTK_AUTHOR("InfoDev");
   BBTK_DESCRIPTION("No Description.");
   BBTK_CATEGORY("empty");
-  BBTK_INPUT(VectorFilterDouble,Type,"default (0)  0=Erase duplicated lines, 1=Redimention Vectors, 2=Insert intermediat points,3=Adition k1, 4=Substraction k1, 5=Multilication k1, 6=Division k1, 7=Connect mesh X1,Y1,Z1,idxs1,X2,X2,X2,idx2, 8=Order All vectors with the logic of In0 , 9=Invert Vectors, 10=Nearest Point in the vector. In3PointXYZ In0LstX In1LstY In2LstZ  (Out0-index Out1-PointXYZ), 11=Mul Spacing (K1[spcX,spcY,spcZ]=Spacing), 12=Div Spacing (K1[spcX,spcY,spcZ]=Spacing), 13=Distance pointIn0 and pontIn1,  14=Select specific segments [k1] in In0=lstPx In1=lstPy In2=lstPz In3=lstIndex (if k1 empty all segments are selected) ",int,"");
-  BBTK_INPUT(VectorFilterDouble,k1,"(default [0])  nothing (Type0), k1[0]=new size vectors (Type 1) , nothing (Type2), k1[0] = Addition const. (Type 3), k1[0] = Substraction const. (Type 4), k1[0] = Multiplication const. (Type 5) , k1[0] = Division const. (Type 6)  , k1[spcX,spcY,spcZ] MulSpc In0_X,In1_Y,In2_Z (type 11),  k1[spcX,spcY,spcZ] DivSpc In0_X,In1_Y,In2_Z (type 12) , k1[segment1, segment2,..] (type 14) ",std::vector<double>,"");
+  BBTK_INPUT(VectorFilterDouble,Type,"default (0)  0=Erase duplicated lines, 1=Redimention Vectors, 2=Insert intermediat points,3=Adition k1, 4=Substraction k1, 5=Multilication k1, 6=Division k1, 7=Connect mesh X1,Y1,Z1,idxs1,X2,X2,X2,idx2, 8=Order All vectors with the logic of In0 , 9=Invert Vectors, 10=Nearest Point in the vector. In3PointXYZ In0LstX In1LstY In2LstZ  (Out0-index Out1-PointXYZ), 11=Mul Spacing (K1[spcX,spcY,spcZ]=Spacing), 12=Div Spacing (K1[spcX,spcY,spcZ]=Spacing), 13=Distance pointIn0 and pontIn1,  14=Select specific segments [k1] in In0=lstPx In1=lstPy In2=lstPz In3=lstIndex (if k1 empty all segments are selected) , 15 swhitch element in a point k1=0 yz, k1=1 nothing k2=2 xz",int,"");
+  BBTK_INPUT(VectorFilterDouble,k1,"(default [0])  nothing (Type0), k1[0]=new size vectors (Type 1) , nothing (Type2), k1[0] = Addition const. (Type 3), k1[0] = Substraction const. (Type 4), k1[0] = Multiplication const. (Type 5) , k1[0] = Division const. (Type 6)  , k1[spcX,spcY,spcZ] MulSpc In0_X,In1_Y,In2_Z (type 11),  k1[spcX,spcY,spcZ] DivSpc In0_X,In1_Y,In2_Z (type 12) , k1[segment1, segment2,..] (type 14) , direction (type 15) ",std::vector<double>,"");
   BBTK_INPUT(VectorFilterDouble,In0,"Input vector",std::vector<double>,"");
   BBTK_INPUT(VectorFilterDouble,In1,"Input vector",std::vector<double>,"");
   BBTK_INPUT(VectorFilterDouble,In2,"Input vector",std::vector<double>,"");
index ef5ec23d8810a246c12a4b35fa86f75406d6052c..820e2ae0ff2f93f922733f0a2ea2519662a78f8e 100644 (file)
@@ -151,11 +151,11 @@ namespace bbwx
   BBTK_NAME("CheckBox");
   BBTK_AUTHOR("jpr@creatis.insa-lyon.fr");
   // Already inserted for any WxBlackBox  BBTK_CATEGORY("widget");
-  BBTK_DESCRIPTION("(C++,Python) CheckBox widget");
+  BBTK_DESCRIPTION("(C++,Python,JavaScript) CheckBox widget");
   BBTK_INPUT(CheckBox, In,   "Initial value of the CheckBox (default false)",bool,       "");
   BBTK_INPUT(CheckBox, Title,"Title shown above the CheckBox (default '') ", std::string,"");
   BBTK_OUTPUT(CheckBox,Out,  "Current value of the CheckBox",                bool,       "");
-  BBTK_INPUT(CheckBox,ReactiveOnKeystroke,"0: no event generated when the checkbox is clicked on, 1: event generated when the checkbox is clicked on (default 1) ", int,"");
+  BBTK_INPUT(CheckBox,ReactiveOnKeystroke,"(default 1)   0: no event generated when the checkbox is clicked on, 1: event generated when the checkbox is clicked on ", int,"");
   BBTK_END_DESCRIBE_BLACK_BOX(CheckBox);
   //=================================================================
   
index 68ea71c3a668f7700c1940c70c485ca7682dcb38..59735b103a311011334025165f79775dd3064815 100644 (file)
@@ -40,7 +40,7 @@ class bbwx_EXPORT ComboBox
 BBTK_BEGIN_DESCRIBE_BLACK_BOX(ComboBox,bbtk::WxBlackBox);
        BBTK_NAME("ComboBox");
        BBTK_AUTHOR("Info-Dev");
-       BBTK_DESCRIPTION("(C++,Python) wxComboBox");
+       BBTK_DESCRIPTION("(C++,Python,JavaScript) wxComboBox");
        BBTK_CATEGORY("__CategoryBlackBox__");
 
        BBTK_INPUT(ComboBox,Title,"Title prepended to the text",std::string,"");