From: Eduardo DAVILA Date: Mon, 19 Jun 2023 13:12:44 +0000 (+0200) Subject: #3518 ShowNPoints propose new points in new Collection (group) X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=add38321cec1e1065096a68e33d3b83f127f9f46;p=creaMaracasVisu.git #3518 ShowNPoints propose new points in new Collection (group) --- diff --git a/bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbg b/bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbg index 48bb2dd..4d2b9ac 100644 --- a/bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbg +++ b/bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbg @@ -72,7 +72,7 @@ COMPLEX_PORT meshmanagermodel -150.374274:130.740991:-900.000000 FIN_COMPLEX_PORT -BOXES:86 +BOXES:84 BOX creaMaracasVisu:ShowNPoints:showNpoints ISEXEC:FALSE @@ -764,18 +764,6 @@ PORT Orientation:"H" FIN_BOX BOX -wx:OutputText:Box128 -ISEXEC:FALSE -120.937187:-68.167658:-900.000000 -142.717187:-70.667658:-900.000000 -FIN_BOX -BOX -wx:OutputText:Box129 -ISEXEC:FALSE -125.385650:-72.286605:-900.000000 -147.165650:-74.786605:-900.000000 -FIN_BOX -BOX wx:LayoutLine:Box130 ISEXEC:FALSE 108.922083:-61.432768:-900.000000 @@ -789,7 +777,7 @@ ISEXEC:FALSE -17.624192:-45.101554:-900.000000 4.155808:-47.601554:-900.000000 FIN_BOX -CONNECTIONS:171 +CONNECTIONS:169 CONNECTION Box06:LstContourPointsX:Box04:LstX NumberOfControlPoints:0 @@ -1280,12 +1268,6 @@ CONNECTION Box127:Widget:Box50:Widget6 NumberOfControlPoints:0 CONNECTION -Box118:Widget:Box130:Widget2 -NumberOfControlPoints:0 -CONNECTION -Box124:Widget:Box130:Widget4 -NumberOfControlPoints:0 -CONNECTION Box130:Widget:Box121:Widget3 NumberOfControlPoints:0 CONNECTION @@ -1298,9 +1280,9 @@ CONNECTION Box131:Widget:Box50:Widget9 NumberOfControlPoints:0 CONNECTION -Box129:Widget:Box121:Widget9 +Box124:Widget:Box130:Widget1 NumberOfControlPoints:0 CONNECTION -Box128:Widget:Box121:Widget8 +Box118:Widget:Box130:Widget3 NumberOfControlPoints:0 APP_END diff --git a/bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbs b/bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbs index 9548fea..f6ed0d6 100644 --- a/bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbs +++ b/bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbs @@ -281,10 +281,6 @@ new creaMaracasVisu:ShowNPoints_Tools Box126 new wx:LayoutLine Box127 set Box127.Orientation "H" -new wx:OutputText Box128 - -new wx:OutputText Box129 - new wx:LayoutLine Box130 set Box130.Orientation "V" @@ -439,14 +435,12 @@ connect showNpoints.WidgetShowNPoints Box122.WidgetShowNPoints connect showNpoints.WidgetShowNPoints Box126.WidgetShowNPoints connect Box108.Widget Box127.Widget2 connect Box127.Widget Box50.Widget6 -connect Box118.Widget Box130.Widget2 -connect Box124.Widget Box130.Widget4 connect Box130.Widget Box121.Widget3 connect Box106.Widget Box127.Widget5 connect Box103.Widget Box50.Widget7 connect Box131.Widget Box50.Widget9 -connect Box129.Widget Box121.Widget9 -connect Box128.Widget Box121.Widget8 +connect Box124.Widget Box130.Widget1 +connect Box118.Widget Box130.Widget3 # Complex input ports input point showNpoints.In " " diff --git a/bbtk/src/bbcreaMaracasVisuManualContourModel_Box.cxx b/bbtk/src/bbcreaMaracasVisuManualContourModel_Box.cxx index 41b98dc..3a8922e 100644 --- a/bbtk/src/bbcreaMaracasVisuManualContourModel_Box.cxx +++ b/bbtk/src/bbcreaMaracasVisuManualContourModel_Box.cxx @@ -6,7 +6,6 @@ #include - namespace bbcreaMaracasVisu { diff --git a/bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.cxx b/bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.cxx index 27ebbf9..f7f1a48 100644 --- a/bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.cxx +++ b/bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.cxx @@ -193,17 +193,11 @@ void ShowNPoints_Tools::InitCreateVolumeSurface_Points() pointEnd.push_back( pC3[1] ); pointEnd.push_back( pC3[2] ); - printf("EED ShowNPoints_Tools::InitCreateVolumeSurface_Points 1\n"); wsp->SetActualCollection(0); - printf("EED ShowNPoints_Tools::InitCreateVolumeSurface_Points 2\n"); wsp->SetReferencePoint(pointStart); - printf("EED ShowNPoints_Tools::InitCreateVolumeSurface_Points 3\n"); wsp->OnInsertPoint_(); - printf("EED ShowNPoints_Tools::InitCreateVolumeSurface_Points 4\n"); wsp->SetReferencePoint(pointEnd); - printf("EED ShowNPoints_Tools::InitCreateVolumeSurface_Points 5\n"); wsp->OnInsertPoint_(); - printf("EED ShowNPoints_Tools::InitCreateVolumeSurface_Points 6\n"); wsp->SetActualCollection(2); wsp->SetReferencePoint(pointStart); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ViewShowNPoints.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ViewShowNPoints.cxx index 61e53d9..b4ba379 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ViewShowNPoints.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ViewShowNPoints.cxx @@ -81,7 +81,6 @@ void ViewShowNPoints::AddVtkPoint() vtkActor *sphereActor = vtkActor::New(); sphereActor->SetMapper(sphereMapper); sphereActor->SetOrigin(0, 0, 0); - lstActorsSphere.push_back(sphereActor); if(renderer==NULL){ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx index 43c15a0..a7a0840 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx @@ -11,6 +11,8 @@ #include "WidgetShowNPoints.h" +#include + //---------------------------------------------------------------------- //---------------------------------------------------------------------- //---------------------------------------------------------------------- @@ -517,11 +519,14 @@ void WidgetShowNPoints::AddVtkPoint() //------------------------------------------------------------------------ void WidgetShowNPoints::AddPoint(double x, double y, double z, std::string label) { + printf("WidgetShowNPoints::AddPoint 0 model=%p\n", GetModelShowNPoints() ); GetModelShowNPoints()->AddPoint(x,y,z, label ); // EED 2022-05-19 //AddVtkPoint(); //RefreshPoint(lstActorsSphere.size()-1); + printf("WidgetShowNPoints::AddPoint 1 view=%p\n", GetViewShowNPoints() ); GetViewShowNPoints()->AddPoint(); + printf("WidgetShowNPoints::AddPoint 2\n"); } //------------------------------------------------------------------------ @@ -1114,15 +1119,15 @@ void WidgetShowNPoints::InsertCollection() { ModelShowNPoints* model = new ModelShowNPoints(); ViewShowNPoints* view = new ViewShowNPoints( model ); + view->mopacity = lstViewShowNPoints[0]->mopacity; + view->renderer = lstViewShowNPoints[0]->renderer; model->SetImage( lstModelShowNPoints[0]->GetImage() ); - view->mopacity = lstViewShowNPoints[0]->mopacity; - view->renderer = lstViewShowNPoints[0]->renderer; lstModelShowNPoints.insert( lstModelShowNPoints.begin()+mActualCollection , model ); lstViewShowNPoints.insert( lstViewShowNPoints.begin()+mActualCollection , view ); } //------------------------------------------------------------------------ -void WidgetShowNPoints::InsertCollectionBefore_() +void WidgetShowNPoints::InsertCollectionBefore_() { InsertCollection(); RefreshCollectionText(); @@ -1134,6 +1139,7 @@ void WidgetShowNPoints::InsertCollectionBefore_() void WidgetShowNPoints::OnInsertCollectionBefore_() { InsertCollectionBefore_(); + CreatePointsIntoNewCollection(); UndoRedo_SaveCollection(); } @@ -1155,10 +1161,12 @@ void WidgetShowNPoints::InsertCollectionAfter_() StopTrackPoint(); } + //------------------------------------------------------------------------ void WidgetShowNPoints::OnInsertCollectionAfter_() { InsertCollectionAfter_(); + CreatePointsIntoNewCollection(); UndoRedo_SaveCollection(); } @@ -1168,6 +1176,90 @@ void WidgetShowNPoints::OnInsertCollectionAfter(wxCommandEvent &event) OnInsertCollectionAfter_(); } +//------------------------------------------------------------------------ +void WidgetShowNPoints::CreatePointsIntoNewCollection() +{ + // --------------------------------------------- + printf("\nWidgetShowNPoints::InsertCollection mActualCollection=%d\n",mActualCollection); + int c1 = mActualCollection-1; + int c2 = mActualCollection+1; + if (c2==lstModelShowNPoints.size()) { c2=0; } + if ((c1>=0) && (c1!=c2) ) + { + std::vector c1LstX = lstModelShowNPoints[c1]->GetLstPointsX(); + std::vector c1LstY = lstModelShowNPoints[c1]->GetLstPointsY(); + std::vector c1LstZ = lstModelShowNPoints[c1]->GetLstPointsZ(); + std::vector c2LstX = lstModelShowNPoints[c2]->GetLstPointsX(); + std::vector c2LstY = lstModelShowNPoints[c2]->GetLstPointsY(); + std::vector c2LstZ = lstModelShowNPoints[c2]->GetLstPointsZ(); + std::vector c1LstXX; + std::vector c1LstYY; + std::vector c1LstZZ; + std::vector c2LstXX; + std::vector c2LstYY; + std::vector c2LstZZ; + creaContoursFactory f; + manualContourModel *m; + double x,y,z; + int i,size; + int sc; // sizeContour + + if ( (c1LstX.size()!=0) && (c2LstX.size()!=0) ) + { + // ----------------- Spline 1 -------------------- + sc = 100; + size = c1LstX.size(); + m = (manualContourModel*)f.getContourModel( 1 ); // Spline + // m->SetNumberOfPointsSpline( bbGetInputNbPoints() ); + m->SetNumberOfPointsSpline( sc ); + m->SetCloseContour( false ); + for (i=0;iAddPoint( c1LstX[i] , c1LstY[i] , c1LstZ[i] ); + } // for + m->UpdateSpline(); + for (i=0;iGetSpline_i_Point(i,&x,&y,&z); + c1LstXX.push_back(x); + c1LstYY.push_back(y); + c1LstZZ.push_back(z); + } // for + delete m; + // ----------------- Spline 2 -------------------- + size = c2LstX.size(); + m = (manualContourModel*)f.getContourModel( 1 ); // Spline + // m->SetNumberOfPointsSpline( bbGetInputNbPoints() ); + m->SetNumberOfPointsSpline( sc ); + m->SetCloseContour( false ); + for (i=0;iAddPoint( c2LstX[i] , c2LstY[i] , c2LstZ[i] ); + } // for + m->UpdateSpline(); + for (i=0;iGetSpline_i_Point(i,&x,&y,&z); + c2LstXX.push_back(x); + c2LstYY.push_back(y); + c2LstZZ.push_back(z); + } // for + delete m; + // ----------------- Add new Points -------------------- + i=0; x=(c1LstXX[i]+c2LstXX[i])/2; y=(c1LstYY[i]+c2LstYY[i])/2; z=(c1LstZZ[i]+c2LstZZ[i])/2; AddPoint(x,y,z,""); +// i=33; x=(c1LstXX[i]+c2LstXX[i])/2; y=(c1LstYY[i]+c2LstYY[i])/2; z=(c1LstZZ[i]+c2LstZZ[i])/2; AddPoint(x,y,z,""); +// i=66; x=(c1LstXX[i]+c2LstXX[i])/2; y=(c1LstYY[i]+c2LstYY[i])/2; z=(c1LstZZ[i]+c2LstZZ[i])/2; AddPoint(x,y,z,""); + i=25; x=(c1LstXX[i]+c2LstXX[i])/2; y=(c1LstYY[i]+c2LstYY[i])/2; z=(c1LstZZ[i]+c2LstZZ[i])/2; AddPoint(x,y,z,""); + i=50; x=(c1LstXX[i]+c2LstXX[i])/2; y=(c1LstYY[i]+c2LstYY[i])/2; z=(c1LstZZ[i]+c2LstZZ[i])/2; AddPoint(x,y,z,""); + i=75; x=(c1LstXX[i]+c2LstXX[i])/2; y=(c1LstYY[i]+c2LstYY[i])/2; z=(c1LstZZ[i]+c2LstZZ[i])/2; AddPoint(x,y,z,""); + i=sc-1;x=(c1LstXX[i]+c2LstXX[i])/2; y=(c1LstYY[i]+c2LstYY[i])/2; z=(c1LstZZ[i]+c2LstZZ[i])/2; AddPoint(x,y,z,""); + } // if size of c1LstX c2LstX + } // if c1 && c2 + +} + + + //------------------------------------------------------------------------ void WidgetShowNPoints::DeleteCollection_() { diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h index 9a6ab0d..193f287 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h @@ -56,6 +56,7 @@ class WidgetShowNPoints : public wxPanel void InsertCollectionAfter_(); void OnInsertCollectionAfter_(); void OnInsertCollectionAfter(wxCommandEvent &event); + void CreatePointsIntoNewCollection(); void OnDeleteCollection_(); void OnDeleteCollection(wxCommandEvent &event); void DeleteCollection_();