]> Creatis software - creaContours.git/commitdiff
#3402 MoveCtrolPoint vtk9itk5wx3-macos
authoreduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Sun, 19 Oct 2025 16:25:13 +0000 (18:25 +0200)
committereduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Sun, 19 Oct 2025 16:25:13 +0000 (18:25 +0200)
bbtk/bbs/boxes/ContourReferenceStep.bbg
bbtk/bbs/boxes/ContourReferenceStep.bbs
bbtk/src/bbcreaContourswxContourMainFrame_tool.cxx
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h

index 1dff826bd361dcf53e45e5bf895d3b784decdfd0..627829db31eb18f40993d91652e14430e7db3679 100644 (file)
@@ -14,19 +14,19 @@ PACKAGENAME:creaContours
 COMPLEXOUTPUTS:4
 COMPLEX_PORT
 _widget
--63.491296:-134.823351:-900.000000
+-62.110902:-180.376367:-900.000000
 FIN_COMPLEX_PORT
 COMPLEX_PORT
 _initExec
--0.123743:-139.211179:-900.000000
+1.256651:-184.764195:-900.000000
 FIN_COMPLEX_PORT
 COMPLEX_PORT
 _iaxis
-44.663851:-138.928196:-900.000000
+46.044245:-184.481212:-900.000000
 FIN_COMPLEX_PORT
 COMPLEX_PORT
 _step
--23.031012:-136.184078:-900.000000
+-21.650618:-181.737094:-900.000000
 FIN_COMPLEX_PORT
 COMPLEXINPUTS:11
 COMPLEX_PORT
@@ -47,7 +47,7 @@ _wxvtkbaseview4
 FIN_COMPLEX_PORT
 COMPLEX_PORT
 _boxExecViewer
-27.552540:157.149325:-900.000000
+26.506787:171.162420:-900.000000
 FIN_COMPLEX_PORT
 COMPLEX_PORT
 _wxcontourmainframe
@@ -86,7 +86,7 @@ BOX
 wx:LayoutLine:Box84
 ISEXEC:FALSE
 -40.823021:57.864276:-900.000000
--7.503021:55.364276:-900.000000
+-5.743021:55.364276:-900.000000
 PORT
 WinTitle:"Config"
 FIN_BOX
@@ -94,7 +94,7 @@ BOX
 wx:Slider:Box86
 ISEXEC:FALSE
 -18.014851:72.040426:-900.000000
-11.785149:69.540426:-900.000000
+13.545149:69.540426:-900.000000
 PORT
 In:"0"
 PORT
@@ -110,7 +110,7 @@ BOX
 wx:CommandButton:Box152
 ISEXEC:FALSE
 -0.916533:16.537159:-900.000000
-21.468467:14.037159:-900.000000
+21.843467:14.037159:-900.000000
 PORT
 Label:"+"
 FIN_BOX
@@ -118,7 +118,7 @@ BOX
 wx:CommandButton:Box153
 ISEXEC:FALSE
 -36.265034:45.821791:-900.000000
--13.880034:43.321791:-900.000000
+-13.505034:43.321791:-900.000000
 PORT
 Label:"-"
 FIN_BOX
@@ -126,7 +126,7 @@ BOX
 wx:LayoutLine:Box154
 ISEXEC:FALSE
 -41.709384:-47.420434:-900.000000
--8.389384:-49.920434:-900.000000
+-6.629384:-49.920434:-900.000000
 PORT
 Orientation:"H"
 FIN_BOX
@@ -253,8 +253,8 @@ FIN_BOX
 BOX
 wx:LayoutLine:Box261
 ISEXEC:FALSE
--136.143816:-91.615476:-900.000000
--102.823816:-94.115476:-900.000000
+-126.250989:-114.852115:-900.000000
+-91.170989:-117.352115:-900.000000
 FIN_BOX
 BOX
 std:ReplaceCleanString:Box265
@@ -273,8 +273,8 @@ FIN_BOX
 BOX
 std:CreateArithmeticSuiteVector:Box284
 ISEXEC:FALSE
-91.819752:56.128381:-900.000000
-115.349752:53.628381:-900.000000
+69.292324:57.989822:-900.000000
+92.822324:55.489822:-900.000000
 PORT
 Delta:"0"
 PORT
@@ -283,8 +283,8 @@ FIN_BOX
 BOX
 std:GetDoubleVectorSize:Box285
 ISEXEC:FALSE
-99.344123:65.073879:-900.000000
-122.169123:62.573879:-900.000000
+73.388525:64.343753:-900.000000
+96.213525:61.843753:-900.000000
 FIN_BOX
 BOX
 std:VectorFilterDouble:Box286
@@ -358,7 +358,7 @@ BOX
 wx:ComboBox:Box314
 ISEXEC:FALSE
 -74.787862:103.567444:-900.000000
--48.507862:101.067444:-900.000000
+-46.747862:101.067444:-900.000000
 PORT
 In:"void"
 PORT
@@ -458,7 +458,7 @@ BOX
 wx:ComboBox:Box330
 ISEXEC:FALSE
 -66.679469:48.992905:-900.000000
--40.399469:46.492905:-900.000000
+-38.639469:46.492905:-900.000000
 PORT
 In:"Direct   Grid   Contour   Nothing"
 PORT
@@ -469,16 +469,16 @@ FIN_BOX
 BOX
 wx:LayoutLine:Box331
 ISEXEC:FALSE
--54.136649:-85.097407:-900.000000
--20.816649:-87.597407:-900.000000
+102.549117:-38.975498:-900.000000
+137.629117:-41.475498:-900.000000
 PORT
 Orientation:"H"
 FIN_BOX
 BOX
 wx:LayoutLine:Box336
 ISEXEC:FALSE
--76.236316:-101.790425:-900.000000
--42.916316:-104.290425:-900.000000
+-74.855922:-147.343441:-900.000000
+-39.775922:-149.843441:-900.000000
 PORT
 Orientation:"H"
 PORT
@@ -523,14 +523,6 @@ ISEXEC:FALSE
 -97.007170:-86.890545:-900.000000
 FIN_BOX
 BOX
-std:GetVectorIntElement:Box436
-ISEXEC:FALSE
-132.935911:69.244296:-900.000000
-155.705911:66.744296:-900.000000
-PORT
-I:"1"
-FIN_BOX
-BOX
 vtk:ImageVtkProperties:Box437
 ISEXEC:FALSE
 172.415091:123.709779:-900.000000
@@ -597,8 +589,8 @@ FIN_BOX
 BOX
 wx:LayoutTab:Box456
 ISEXEC:FALSE
--66.962918:-120.191983:-900.000000
--33.642918:-122.691983:-900.000000
+-65.582524:-165.744999:-900.000000
+-30.502524:-168.244999:-900.000000
 FIN_BOX
 BOX
 std:MagicBox:Box457
@@ -627,8 +619,8 @@ FIN_BOX
 BOX
 std:Div:Box81
 ISEXEC:FALSE
-89.749833:5.376465:-900.000000
-110.674833:2.876465:-900.000000
+89.540682:8.722876:-900.000000
+110.465682:6.222876:-900.000000
 FIN_BOX
 BOX
 std:GetVectorDoubleElement:Box82
@@ -701,11 +693,19 @@ FIN_BOX
 BOX
 std:MathOperation:Box102
 ISEXEC:FALSE
-86.082393:-4.348240:-900.000000
-108.292393:-6.848240:-900.000000
+86.082393:-0.165227:-900.000000
+108.292393:-2.665227:-900.000000
 PORT
 Type:"22"
 FIN_BOX
+BOX
+std:GetVectorDoubleElement:Box93
+ISEXEC:FALSE
+141.018026:79.941838:-900.000000
+164.143026:77.441838:-900.000000
+PORT
+I:"1"
+FIN_BOX
 CONNECTIONS:138
 CONNECTION
 Box86:Widget:Box84:Widget2
@@ -936,9 +936,6 @@ CONNECTION
 Box355:Widget:Box261:Widget6
 NumberOfControlPoints:0
 CONNECTION
-Box436:Out:Box287:In2
-NumberOfControlPoints:0
-CONNECTION
 Box447:BoxChange:Box448:In1
 NumberOfControlPoints:0
 CONNECTION
@@ -1104,9 +1101,6 @@ CONNECTION
 Box450:Out:Box97:In0
 NumberOfControlPoints:0
 CONNECTION
-Box97:Out:Box436:In
-NumberOfControlPoints:0
-CONNECTION
 Box317:Out:_step:_step
 NumberOfControlPoints:0
 CONNECTION
@@ -1121,4 +1115,10 @@ NumberOfControlPoints:0
 CONNECTION
 Box102:Out:Box299:In
 NumberOfControlPoints:0
+CONNECTION
+Box97:Out:Box93:In
+NumberOfControlPoints:0
+CONNECTION
+Box93:Out:Box287:In2
+NumberOfControlPoints:0
 APP_END
index 11282abd473dbdf7e0222a6754c082380979b71f..10a7d39b06fc06cf5974c220beb28905afe47118 100644 (file)
@@ -186,9 +186,6 @@ new std:VectorFilterDouble Box354
 
 new wx:OutputText Box355
 
-new std:GetVectorIntElement Box436
-  set Box436.I "1"
-
 new vtk:ImageVtkProperties Box437
 
 new creaMaracasVisu:wxVtkBaseView_Info Box447
@@ -251,6 +248,9 @@ new std:MathOperationVector Box97
 new std:MathOperation Box102
   set Box102.Type "22"
 
+new std:GetVectorDoubleElement Box93
+  set Box93.I "1"
+
 
 connect Box86.Widget Box84.Widget2
 connect Box153.Widget Box154.Widget2
@@ -328,7 +328,6 @@ connect Box352.Out0 Box348.In
 connect Box349.Out Box354.In0
 connect Box354.Out0 Box352.In0
 connect Box355.Widget Box261.Widget6
-connect Box436.Out Box287.In2
 connect Box447.BoxChange Box448.In1
 connect Box448.BoxChange Box83.BoxExecute
 connect Box449.BoxChange Box448.In3
@@ -370,11 +369,12 @@ connect Box75.Out Box96.k1
 connect Box96.Out0 Box82.In
 connect Box96.Out0 Box97.In1
 connect Box450.Out Box97.In0
-connect Box97.Out Box436.In
 connect Box75.Out Box83.Direction
 connect Box81.Out Box102.In1
 connect Box102.Out Box329.In3
 connect Box102.Out Box299.In
+connect Box97.Out Box93.In
+connect Box93.Out Box287.In2
 
 # Complex input ports
 input _wxvtkbaseview2 Box452.In " "
index e71eb2ac0270fc12e28f1d6361fcf0bcfa5249ea..cb89d79bb81f3c8b9c6980102c595989750d9292 100644 (file)
@@ -111,12 +111,21 @@ void wxContourMainFrame_tool::Process()
             // Todo....   implementd in JavaScript
         } // Type 6
         
-
+        // Move Control Point Normal direction
+        if (bbGetInputType()==10)
+        {
+            std::vector<double> param1  =bbGetInputParam1();
+            int idContour               = (int)param1[0];
+            int idControlPoint          = (int)param1[1];
+            printf("EED wxContourMainFrame_tool::Process type 10   idControlPoint=%d\n", idControlPoint );
+            int step                    = (int)param1[2];
+            wxContourMainFrame::getInstance()->MoveControlPoint( idContour , idControlPoint, step );
+        } // Type 10
 
     } // if wxContourMainFrame::getInstance()!=NULL
-
 }
-//===== 
+
+//=====
 // 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)
 //===== 
 void wxContourMainFrame_tool::bbUserSetDefaultValues()
index bacc23c4178b4f1a682d6335d569f607c2fa9274..986cfd27f7ff9f9d7dddc15cd20d927991f98540 100644 (file)
 //----------------------------------------------------------------------------------------------------------------
 #include "wxContourMainFrame.h"
 
-
-
 //----------------------------------------------------------------------------------------------------------------
 // Includes
 //----------------------------------------------------------------------------------------------------------------
 
-
 #include "NameWrapper.h"
 #include "wx/artprov.h"
 #include "ConceptDataWrap.h"
@@ -3445,3 +3442,47 @@ void wxContourMainFrame::SetMaxContoursByInstant(int max)
     _maxContoursByInstant = max;
 }
 
+void wxContourMainFrame::MoveControlPoint( int idContour , int idControlPoint, int step )
+{
+    //std::vector<int> tempVector;
+    //getInstantVector( tempVector );
+    Instant *instant = kernelManager->getCurrentInstant ();
+    std::vector< ContourThing ** >  lstContours =   kernelManager->getOutlinesAtInstant (instant);
+    if (lstContours.size()>0)
+    {
+        manualBaseModel *mbm = (*(lstContours[0]))->getModel();
+//        int idxxxx = mbm->GetIdPoint( px , pz , -1 , 50000 , 2);
+        
+        
+        int id1=idControlPoint - 1;
+        if ( id1<0 )
+        {
+            id1 = mbm->GetSizeLstPoints()-1;
+        } // if id1 < 0
+        
+        int id2=idControlPoint + 1;
+        if ( id2==mbm->GetSizeLstPoints() )
+        {
+            id2 = 0;
+        } // if id2 = maxpoints list
+
+        manualPoint *mp1 = mbm->GetManualPoint(id1);
+        manualPoint *mp2 = mbm->GetManualPoint(id2);
+
+        double vx = mp2->GetX() - mp1->GetX();
+        double vy = mp2->GetY() - mp1->GetY();
+
+        // normalice
+        double hip = sqrt( vx*vx + vy*vy );
+        vx =vx / hip;
+        vy =vy / hip;
+
+        // 90 degree rotation
+        double vxB = -vy;
+        double vyB = vx;
+        
+        mbm->MovePoint( idControlPoint ,vxB*step,vyB*step,0);
+        RefreshInterface();
+    } //
+    
+}
index b4b3ad5f675f60099e07c9a61ed83683b775f44f..76c882fb301e0f561e1202969e1d1c5be33e6c70 100644 (file)
@@ -242,8 +242,8 @@ class wxContourMainFrame : public wxPanel {
        void showAxis(bool show);
        void onRigidPressed();
        void onWidthOfContour(double width);
-       int getColorWindow();
-       int getWindowLevel();
+       int  getColorWindow();
+       int  getWindowLevel();
        void onBrigthnessColorWindowLevel(int colorwindow,int windowlevel);
        void onInterpolation(bool interpolate);
        void onShowTextContour(bool show);
@@ -330,9 +330,9 @@ class wxContourMainFrame : public wxPanel {
     // Use by BBTK boxes
        void    SetXY(int x,int y);
     void    ResetCamera();
-
     void    CleanContoursWithEmptyPoints();
     void    SetMaxContoursByInstant(int max);
+    void    MoveControlPoint( int idContour , int idControlPoint, int step );
     
 private:
        //------------------------------------------------------------------------------------------------------------
@@ -361,7 +361,7 @@ private:
        wxAuiNotebook               *notebook;
     long                                               m_notebook_style;
     long                       m_notebook_theme;
-    int                         _numberOfVariablesStatistics;
+    int                        _numberOfVariablesStatistics;
 
        // Contour Image Mask
        ThresholdImageView                      *_viewMaskImage;