From e124a4608256093c55a5ffad09b4290a2f66dc62 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Mon, 26 Jun 2023 14:25:05 +0200 Subject: [PATCH] #3519 ShowNpoints with aux_mesh --- bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbg | 215 +++--------- bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbs | 72 +---- .../bbcreaMaracasVisuShowNPoints_Tools.cxx | 31 +- bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.h | 3 +- .../wxWindows/widgets/ModelShowNPoints.cxx | 32 +- .../wxWindows/widgets/WidgetShowNPoints.cxx | 305 +++++++++++++++--- .../wxWindows/widgets/WidgetShowNPoints.h | 74 +++-- .../wxWindows/widgets/wxVtkMPR3DView.cxx | 8 +- .../widgets/wxVtkMPR3DViewCntrlPanel.cxx | 2 +- 9 files changed, 407 insertions(+), 335 deletions(-) diff --git a/bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbg b/bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbg index 4d2b9ac..e38385c 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:84 +BOXES:75 BOX creaMaracasVisu:ShowNPoints:showNpoints ISEXEC:FALSE @@ -212,8 +212,8 @@ FIN_BOX BOX wx:LayoutLine:Box79 ISEXEC:FALSE --144.841026:-82.628158:-900.000000 --111.521026:-85.128158:-900.000000 +-143.046813:-112.731071:-900.000000 +-109.726813:-115.231071:-900.000000 PORT Orientation:"H" PORT @@ -290,8 +290,8 @@ FIN_BOX BOX wx:LayoutLine:Box38 ISEXEC:FALSE --190.854929:-82.522396:-900.000000 --157.534929:-85.022396:-900.000000 +-189.060716:-112.625309:-900.000000 +-155.740716:-115.125309:-900.000000 PORT Orientation:"H" PORT @@ -300,14 +300,14 @@ FIN_BOX BOX wx:LayoutTab:Box39 ISEXEC:FALSE --195.888488:-89.508403:-900.000000 --162.568488:-92.008403:-900.000000 +-194.094275:-119.611316:-900.000000 +-160.774275:-122.111316:-900.000000 FIN_BOX BOX wx:LayoutTab:Box40 ISEXEC:FALSE --148.825313:-89.038628:-900.000000 --115.505313:-91.538628:-900.000000 +-147.031100:-119.141541:-900.000000 +-113.711100:-121.641541:-900.000000 FIN_BOX BOX wx:CommandButton:Box42 @@ -364,8 +364,8 @@ FIN_BOX BOX wx:LayoutLine:Box50 ISEXEC:FALSE --42.742907:-58.168804:-900.000000 --9.422907:-60.668804:-900.000000 +-26.479356:-58.435420:-900.000000 +6.840644:-60.935420:-900.000000 PORT Orientation:"V" PORT @@ -446,8 +446,8 @@ FIN_BOX BOX wx:LayoutLine:Box81 ISEXEC:FALSE --184.734921:-96.564525:-900.000000 --151.414921:-99.064525:-900.000000 +-182.940708:-126.667438:-900.000000 +-149.620708:-129.167438:-900.000000 PORT WinTitle:"Step 1. Surface" FIN_BOX @@ -466,8 +466,8 @@ FIN_BOX BOX wx:LayoutTab:Box86 ISEXEC:FALSE --55.020341:-67.071239:-900.000000 --21.700341:-69.571239:-900.000000 +-54.839107:-68.339875:-900.000000 +-21.519107:-70.839875:-900.000000 FIN_BOX BOX creaVtk:MeshManager:Box92 @@ -580,8 +580,8 @@ FIN_BOX BOX wx:ComboBox:Box108 ISEXEC:FALSE --63.731818:76.682466:-900.000000 --37.451818:74.182466:-900.000000 +135.425863:49.171195:-900.000000 +161.705863:46.671195:-900.000000 FIN_BOX BOX std:AddStringToVector:Box109 @@ -650,134 +650,46 @@ PORT In1:"Tool - Join start and end points to current spline" FIN_BOX BOX -creaMaracasVisu:ShowNPoints_Tools:Box116 -ISEXEC:FALSE -83.181891:-37.997829:-900.000000 -105.726891:-40.497829:-900.000000 -PORT -BoxProcessMode:"Manual" -PORT -Params:" -1" -PORT -Type:"230" -FIN_BOX -BOX -wx:CommandButton:Box117 -ISEXEC:FALSE -100.839007:-14.508839:-900.000000 -123.224007:-17.008839:-900.000000 -PORT -Label:"-" -FIN_BOX -BOX -wx:LayoutLine:Box118 -ISEXEC:FALSE -94.757325:-47.167548:-900.000000 -128.077325:-49.667548:-900.000000 -PORT -Orientation:"H" -FIN_BOX -BOX -wx:CommandButton:Box119 -ISEXEC:FALSE -131.048147:-14.696561:-900.000000 -153.433147:-17.196561:-900.000000 -PORT -Label:"+" -FIN_BOX -BOX -creaMaracasVisu:ShowNPoints_Tools:Box120 -ISEXEC:FALSE -118.818739:-37.869439:-900.000000 -141.363739:-40.369439:-900.000000 -PORT -BoxProcessMode:"Manual" -PORT -Params:" 1" -PORT -Type:"230" -FIN_BOX -BOX wx:LayoutLine:Box121 ISEXEC:FALSE -100.845652:-78.053543:-900.000000 -134.165652:-80.553543:-900.000000 +-55.608595:-58.187882:-900.000000 +-22.288595:-60.687882:-900.000000 PORT Orientation:"V" PORT WinTitle:"1.1 Splines" FIN_BOX BOX -creaMaracasVisu:ShowNPoints_Tools:Box122 -ISEXEC:FALSE -165.760712:-38.975325:-900.000000 -188.305712:-41.475325:-900.000000 -PORT -BoxProcessMode:"Manual" -PORT -Params:"-1" -PORT -Type:"235" -FIN_BOX -BOX -wx:CommandButton:Box123 -ISEXEC:FALSE -183.417828:-15.486335:-900.000000 -205.802828:-17.986335:-900.000000 -PORT -Label:"<" -FIN_BOX -BOX -wx:LayoutLine:Box124 +wx:LayoutLine:Box127 ISEXEC:FALSE -167.780189:-48.474560:-900.000000 -201.100189:-50.974560:-900.000000 +-46.207243:29.221590:-900.000000 +-12.887243:26.721590:-900.000000 PORT Orientation:"H" FIN_BOX BOX -wx:CommandButton:Box125 +wx:OutputText:Box131 ISEXEC:FALSE -213.626968:-15.674057:-900.000000 -236.011968:-18.174057:-900.000000 -PORT -Label:">" +-17.624192:-45.101554:-900.000000 +4.155808:-47.601554:-900.000000 FIN_BOX BOX -creaMaracasVisu:ShowNPoints_Tools:Box126 +creaMaracasVisu:ShowNPoints_Tools:Box132 ISEXEC:FALSE -201.397560:-38.846935:-900.000000 -223.942560:-41.346935:-900.000000 +60.800054:-98.532649:-900.000000 +83.345054:-101.032649:-900.000000 PORT BoxProcessMode:"Manual" PORT -Params:"1" -PORT -Type:"235" -FIN_BOX -BOX -wx:LayoutLine:Box127 -ISEXEC:FALSE --46.207243:29.221590:-900.000000 --12.887243:26.721590:-900.000000 -PORT -Orientation:"H" +Type:"250" FIN_BOX BOX -wx:LayoutLine:Box130 +std:ConcatStrings:Box120 ISEXEC:FALSE -108.922083:-61.432768:-900.000000 -142.242083:-63.932768:-900.000000 -PORT -Orientation:"V" -FIN_BOX -BOX -wx:OutputText:Box131 -ISEXEC:FALSE --17.624192:-45.101554:-900.000000 -4.155808:-47.601554:-900.000000 +134.627918:41.900202:-900.000000 +157.387918:39.400202:-900.000000 FIN_BOX -CONNECTIONS:169 +CONNECTIONS:156 CONNECTION Box06:LstContourPointsX:Box04:LstX NumberOfControlPoints:0 @@ -1208,81 +1120,42 @@ CONNECTION Box49:OutString:Box29:NbPoints NumberOfControlPoints:0 CONNECTION -showNpoints:WidgetShowNPoints:Box116:WidgetShowNPoints -NumberOfControlPoints:0 -CONNECTION -Box68:Spacing:Box116:Spacing -NumberOfControlPoints:0 -CONNECTION -Box117:BoxChange:Box116:BoxExecute -NumberOfControlPoints:0 -CONNECTION -Box117:Widget:Box118:Widget2 -NumberOfControlPoints:0 -CONNECTION -Box119:Widget:Box118:Widget3 -NumberOfControlPoints:0 -CONNECTION -Box119:BoxChange:Box120:BoxExecute -NumberOfControlPoints:0 -CONNECTION -showNpoints:WidgetShowNPoints:Box120:WidgetShowNPoints -NumberOfControlPoints:0 -CONNECTION -Box68:Spacing:Box120:Spacing -NumberOfControlPoints:0 -CONNECTION -Box105:Out:Box116:Mesh -NumberOfControlPoints:0 -CONNECTION -Box105:Out:Box120:Mesh -NumberOfControlPoints:0 -CONNECTION showNpoints:Widget:Box121:Widget1 NumberOfControlPoints:0 CONNECTION Box121:Widget:Box86:Widget2 NumberOfControlPoints:0 CONNECTION -Box123:BoxChange:Box122:BoxExecute -NumberOfControlPoints:0 -CONNECTION -Box123:Widget:Box124:Widget2 -NumberOfControlPoints:0 -CONNECTION -Box125:Widget:Box124:Widget3 -NumberOfControlPoints:0 -CONNECTION -Box125:BoxChange:Box126:BoxExecute +Box108:Widget:Box127:Widget2 NumberOfControlPoints:0 CONNECTION -showNpoints:WidgetShowNPoints:Box122:WidgetShowNPoints +Box127:Widget:Box50:Widget6 NumberOfControlPoints:0 CONNECTION -showNpoints:WidgetShowNPoints:Box126:WidgetShowNPoints +Box106:Widget:Box127:Widget5 NumberOfControlPoints:0 CONNECTION -Box108:Widget:Box127:Widget2 +Box103:Widget:Box50:Widget7 NumberOfControlPoints:0 CONNECTION -Box127:Widget:Box50:Widget6 +Box131:Widget:Box50:Widget9 NumberOfControlPoints:0 CONNECTION -Box130:Widget:Box121:Widget3 +showNpoints:WidgetShowNPoints:Box132:WidgetShowNPoints NumberOfControlPoints:0 CONNECTION -Box106:Widget:Box127:Widget5 +Box68:Spacing:Box132:Spacing NumberOfControlPoints:0 CONNECTION -Box103:Widget:Box50:Widget7 +Box105:Out:Box132:Mesh NumberOfControlPoints:0 CONNECTION -Box131:Widget:Box50:Widget9 +Box105:BoxChange:Box132:BoxExecute NumberOfControlPoints:0 CONNECTION -Box124:Widget:Box130:Widget1 +Box108:Out:Box120:In1 NumberOfControlPoints:0 CONNECTION -Box118:Widget:Box130:Widget3 +Box120:Out:Box132:Params NumberOfControlPoints:0 APP_END diff --git a/bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbs b/bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbs index f6ed0d6..6a33a41 100644 --- a/bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbs +++ b/bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbs @@ -236,56 +236,21 @@ new std:AddStringToVector Box115 set Box115.In0 "Tool - Inverse Normals" set Box115.In1 "Tool - Join start and end points to current spline" -new creaMaracasVisu:ShowNPoints_Tools Box116 - set Box116.BoxProcessMode "Manual" - set Box116.Params " -1" - set Box116.Type "230" - -new wx:CommandButton Box117 - set Box117.Label "-" - -new wx:LayoutLine Box118 - set Box118.Orientation "H" - -new wx:CommandButton Box119 - set Box119.Label "+" - -new creaMaracasVisu:ShowNPoints_Tools Box120 - set Box120.BoxProcessMode "Manual" - set Box120.Params " 1" - set Box120.Type "230" - new wx:LayoutLine Box121 set Box121.Orientation "V" set Box121.WinTitle "1.1 Splines" -new creaMaracasVisu:ShowNPoints_Tools Box122 - set Box122.BoxProcessMode "Manual" - set Box122.Params "-1" - set Box122.Type "235" - -new wx:CommandButton Box123 - set Box123.Label "<" - -new wx:LayoutLine Box124 - set Box124.Orientation "H" - -new wx:CommandButton Box125 - set Box125.Label ">" - -new creaMaracasVisu:ShowNPoints_Tools Box126 - set Box126.BoxProcessMode "Manual" - set Box126.Params "1" - set Box126.Type "235" - new wx:LayoutLine Box127 set Box127.Orientation "H" -new wx:LayoutLine Box130 - set Box130.Orientation "V" - new wx:OutputText Box131 +new creaMaracasVisu:ShowNPoints_Tools Box132 + set Box132.BoxProcessMode "Manual" + set Box132.Type "250" + +new std:ConcatStrings Box120 + connect Box06.LstContourPointsX Box04.LstX connect showNpoints.lstIndexs Box06.LstIndexsIn @@ -415,32 +380,19 @@ connect Box58.Out Box115.StringVector connect Box115.Out Box57.In connect Box67.Out Box60.Mesh connect Box49.OutString Box29.NbPoints -connect showNpoints.WidgetShowNPoints Box116.WidgetShowNPoints -connect Box68.Spacing Box116.Spacing -connect Box117.BoxChange Box116.BoxExecute -connect Box117.Widget Box118.Widget2 -connect Box119.Widget Box118.Widget3 -connect Box119.BoxChange Box120.BoxExecute -connect showNpoints.WidgetShowNPoints Box120.WidgetShowNPoints -connect Box68.Spacing Box120.Spacing -connect Box105.Out Box116.Mesh -connect Box105.Out Box120.Mesh connect showNpoints.Widget Box121.Widget1 connect Box121.Widget Box86.Widget2 -connect Box123.BoxChange Box122.BoxExecute -connect Box123.Widget Box124.Widget2 -connect Box125.Widget Box124.Widget3 -connect Box125.BoxChange Box126.BoxExecute -connect showNpoints.WidgetShowNPoints Box122.WidgetShowNPoints -connect showNpoints.WidgetShowNPoints Box126.WidgetShowNPoints connect Box108.Widget Box127.Widget2 connect Box127.Widget Box50.Widget6 -connect Box130.Widget Box121.Widget3 connect Box106.Widget Box127.Widget5 connect Box103.Widget Box50.Widget7 connect Box131.Widget Box50.Widget9 -connect Box124.Widget Box130.Widget1 -connect Box118.Widget Box130.Widget3 +connect showNpoints.WidgetShowNPoints Box132.WidgetShowNPoints +connect Box68.Spacing Box132.Spacing +connect Box105.Out Box132.Mesh +connect Box105.BoxChange Box132.BoxExecute +connect Box108.Out Box120.In1 +connect Box120.Out Box132.Params # Complex input ports input point showNpoints.In " " diff --git a/bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.cxx b/bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.cxx index f7f1a48..52d804e 100644 --- a/bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.cxx +++ b/bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.cxx @@ -136,6 +136,13 @@ void ShowNPoints_Tools::InitCreatePatch_Points() else{ printf("PG ShowNPoints_Tools::CreatePatch_Npoints Warning patch not apply. groups or mesh invalid. Need 1 group of 3 or 4 points, and a mesh\n"); } // if wsp && mesh + + // --- Finish --- + wsp->RefreshCollectionText(); + wsp->RefreshColourCollection(); + wsp->SetOutputBox(); + wsp->UndoRedo_SaveCollection(); + } void ShowNPoints_Tools::InitCreateVolumeSurface_Points() @@ -181,8 +188,7 @@ void ShowNPoints_Tools::InitCreateVolumeSurface_Points() wsp->InsertPoint(pN[0] ,pN[1], pN[2],""); wsp->InsertPoint(pC3[0] ,pC3[1], pC3[2],""); - - + // Add points to the other Groups std::vector pointStart; pointStart.push_back( pC1[0] ); @@ -206,9 +212,13 @@ void ShowNPoints_Tools::InitCreateVolumeSurface_Points() wsp->OnInsertPoint_(); // --- Finish --- + wsp->RefreshCollectionText(); + wsp->RefreshColourCollection(); wsp->SetOutputBox(); wsp->UndoRedo_SaveCollection(); + pointLocator->Delete(); + } // if wsp && mesh } @@ -780,11 +790,13 @@ void ShowNPoints_Tools::MovePointInNormal() pN[2] = p[2] / spc[2] + direction*normal[2]; wsp->GetModelShowNPoints()->SetPointById(idControlPoint, pN); - wsp->GetViewShowNPoints()->RefreshPoint(idControlPoint); +// wsp->GetViewShowNPoints()->RefreshPoint(idControlPoint); + wsp->RefreshCollectionText(); + wsp->RefreshColourCollection(); wsp->SetOutputBox(); wsp->UndoRedo_SaveCollection(); } // if idControlPoint - } //wsp + } // if wsp->GetLstModelShowNPointsSiz->size()>=2 } void ShowNPoints_Tools::ChangeCurrentPoint() @@ -830,6 +842,12 @@ void ShowNPoints_Tools::JoinPoints() } // if Size } +void ShowNPoints_Tools::SetMesh() +{ + WidgetShowNPoints* wsp = bbGetInputWidgetShowNPoints(); + wsp->SetAuxMesh(bbGetInputMesh(), bbGetInputSpacing(), bbGetInputParams() ); +} + //===== // 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) //===== @@ -918,11 +936,14 @@ void ShowNPoints_Tools::Process() { ChangeCurrentPoint(); } // if Type - if(bbGetInputType()==240) { JoinPoints(); } // if Type + if(bbGetInputType()==250) + { + SetMesh(); + } // if Type if(bbGetInputType()==300) { CreateExpandedSurface(); diff --git a/bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.h b/bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.h index 24d45b7..86a7a31 100644 --- a/bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.h +++ b/bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.h @@ -50,6 +50,7 @@ class bbcreaMaracasVisu_EXPORT ShowNPoints_Tools void ExpandPatch(); void MovePointInNormal(); void JoinPoints(); + void SetMesh(); //===== // 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) @@ -64,7 +65,7 @@ BBTK_CATEGORY("empty"); BBTK_INPUT(ShowNPoints_Tools,WidgetShowNPoints,"WidgetShowNPoints",WidgetShowNPoints*,""); BBTK_INPUT(ShowNPoints_Tools,Spacing,"(default [1,1,1] )Spacing",std::vector,""); BBTK_INPUT(ShowNPoints_Tools,Mesh,"Mesh en format vtkPolyData ",vtkPolyData*,""); - BBTK_INPUT(ShowNPoints_Tools,Type,"(default 0) 0:Nothing 1:Auto add poits 5:Add Point 10:Insert Point 20:TrackPoint 30:Set nearest point 40:Erase point 50:Deleta all points 100:Insert group after 110:Delete group 120:Reset colletion 200:Tool 3 or 4 points to patch surface - Create Mesh (based on 1 group and 3 or 4 points) 205:Tool 3 or 4 points to volume surface - Create Mesh (based on 1 group and 3 or 4 points) 210: Invert points 220: Move patch center 230: Move point in normal of surface 240: Join all start-end points to the start-end points on selected spline 300: Create expanded surface 310: Create wide expanded surface 320: Expand Surface, 330: Widen surface, 340: Expand patch",int,""); + BBTK_INPUT(ShowNPoints_Tools,Type,"(default 0) 0:Nothing 1:Auto add poits 5:Add Point 10:Insert Point 20:TrackPoint 30:Set nearest point 40:Erase point 50:Deleta all points 100:Insert group after 110:Delete group 120:Reset colletion 200:Tool 3 or 4 points to patch surface - Create Mesh (based on 1 group and 3 or 4 points) 205:Tool 3 or 4 points to volume surface - Create Mesh (based on 1 group and 3 or 4 points) 210: Invert points 220: Move patch center 230: Move point in normal of surface (Params [-1] or [1]) 235: ChangeCurrentPoint (Params [-1] or [1]) 240: Join all start-end points to the start-end points on selected spline 250: Set Mesh SPC (Params: [0]:Patch [1]:CloseSpline1 [2]:CloseSpline2) 300: Create expanded surface 310: Create wide expanded surface 320: Expand Surface, 330: Widen surface, 340: Expand patch",int,""); BBTK_INPUT(ShowNPoints_Tools, Params,"Optional params for the tools, required for 200: normal and direction, 320: centroid and direction, 330: normal and direction, 340: centroid and direction", std::vector,""); BBTK_OUTPUT(ShowNPoints_Tools, Out, "Output", std::vector, ""); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.cxx index 5bbc223..2f9db62 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.cxx @@ -7,8 +7,8 @@ //---------------------------------------------------------------------- ModelShowNPoints::ModelShowNPoints() { - firsttime=true; - idCurrentPoint = -1; + firsttime = true; + idCurrentPoint = -1; } //---------------------------------------------------------------------- @@ -130,8 +130,9 @@ void ModelShowNPoints::AddPoint(double x, double y, double z, std::string label) lstPointsX.push_back( x ); lstPointsY.push_back( y ); lstPointsZ.push_back( z ); - std::string strLabel = CleanSpaces( label ); + std::string strLabel = CleanSpaces( label ); lstLabels.push_back( strLabel ); + idCurrentPoint = lstPointsX.size()-1; } //------------------------------------------------------------------------ @@ -166,8 +167,8 @@ int ModelShowNPoints::InsertPoint(double x, double y, double z, std::string labe { smallTMP=dTotal[j]; pos = j+1; - } - } + } // if + } // for j // *************** Open contour case Start ******************* @@ -189,9 +190,10 @@ int ModelShowNPoints::InsertPoint(double x, double y, double z, std::string labe pos=0; } else { // after second point pos=2; - } - } - } + } // if a2) { double r3; @@ -204,8 +206,8 @@ int ModelShowNPoints::InsertPoint(double x, double y, double z, std::string labe if (b>r3) // outside circle { pos = 0; - } - } + } // if b>r3 + } // if pos if (pos==lstPointsX.size()-1 ) // last point of the list { i = lstPointsX.size()-2; @@ -213,9 +215,9 @@ int ModelShowNPoints::InsertPoint(double x, double y, double z, std::string labe if (a>r3) // outside circle { pos = pos+1; - } - } - } + } // if a>r3 + } // if pos + } // if lstPointsX.size // *************** Open contour case End ******************* @@ -234,7 +236,8 @@ int ModelShowNPoints::InsertPoint(double x, double y, double z, std::string labe itS = lstLabels.begin(); //Insert Label in list of labels lstLabels.insert( itS+pos, strLabel ); - return pos; + idCurrentPoint=pos; + return pos; } else { return -1; }// if size lst X @@ -407,6 +410,7 @@ void ModelShowNPoints::ErasePoint(int id) lstPointsY.erase( lstPointsY.begin()+id ); lstPointsZ.erase( lstPointsZ.begin()+id ); lstLabels.erase( lstLabels.begin()+id ); + SetIdCurrentPoint(id); } //---------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx index 698a196..12d4589 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx @@ -13,6 +13,13 @@ #include +#include +#include +#include +#include +#include +#include + //---------------------------------------------------------------------- //---------------------------------------------------------------------- //---------------------------------------------------------------------- @@ -21,6 +28,12 @@ WidgetShowNPoints::WidgetShowNPoints(wxWindow *parent, int type) : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL) { + aux_mesh = NULL; + aux_mesh_spc.push_back(1); + aux_mesh_spc.push_back(1); + aux_mesh_spc.push_back(1); + aux_mesh_type = 0; // 0:Patch 1:CloseSpline1 2:CloseSpline2 + // EED 2022-05-19 // mmodelShowNPoints = new ModelShowNPoints(); idUndoRedo = 0; @@ -32,7 +45,6 @@ UndoRedoDir = std::string(""); } else { UndoRedoDir = std::string(val)+"\\creatools"; - printf("WidgetShowNPoints::WidgetShowNPoints UndoRedoDir = %s %p \n", UndoRedoDir.c_str() , this ); std::string cmd1 = "mkdir "+ UndoRedoDir; system( cmd1.c_str() ); // Erasing files of more than 1 day old ( -1 ) @@ -48,7 +60,6 @@ UndoRedoDir = "/tmp/creatools"; #endif - printf("WidgetShowNPoints::WidgetShowNPoints UndoRedoDir = %s %p \n", UndoRedoDir.c_str() , this ); std::string cmd1 = "mkdir "+ UndoRedoDir; system( cmd1.c_str() ); // Erasing files of more than 1 day old ( +1 ) @@ -75,13 +86,13 @@ wxPanel* panel = NULL; wxPanel* panel2 = NULL; txtNrCollections = NULL; + txtNrPoints = NULL; bookSetPoints = new wxNotebook(panelParent, -1, wxDefaultPosition, wxDefaultSize, wxNB_TOP ); panel = new wxPanel(bookSetPoints); - txtNrCollections = NULL; wxSize sizeButton; sizeButton.Set( 45 , -1 ); @@ -228,6 +239,8 @@ Connect(btnNextPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnNextPoint); Connect(btnAddPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnAddPoint); Connect(btnInsertPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnInsertPoint);//CFT + Connect(btnMovePointUp->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnMovePointUp); + Connect(btnMovePointDown->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnMovePointDown); Connect(btnSetPositionPoint->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnSetPoint); Connect(btnRenamePoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnRenamePoint); Connect(btnEraseLastPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnEraseLastPoint); @@ -303,10 +316,10 @@ wxStaticText* txRadio = new wxStaticText(panel, -1, wxString(_T(" Points Radio "))); sdrRadio = new wxSlider(panel, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS); Connect(btnSetPositionPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnSetPoint); - Connect(sdrOpacity->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints); - Connect(sdrRadio->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints); + Connect(sdrOpacity->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints); + Connect(sdrRadio->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints); - wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1); + wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1); sizer1->Add(btnSetPositionPoint); sizer1->Add(txtNrPoints); sizer1->Add(txRadio); @@ -319,8 +332,8 @@ if (mtype == 2) { askPointLabel = new wxStaticText(panel, -1, _T("\nPOINT CONTROLS:")); // JPR - wxButton *btnAddPoint = new wxButton(panel, -1, _T(" Add Point ")); - wxButton *btnDeleteAllPoints = new wxButton(panel, -1, _T(" Delete All ")); + wxButton *btnAddPoint = new wxButton(panel , -1, _T(" Add Point ")); + wxButton *btnDeleteAllPoints = new wxButton(panel , -1, _T(" Delete All ")); wxStaticText *spacer = new wxStaticText(panel, -1, _T("\n")); // JPR textCtrl = new wxTextCtrl(panel, -1); Connect(btnAddPoint->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnAddPoint); @@ -551,26 +564,23 @@ void WidgetShowNPoints::SetCurrentPoint(int idCurrentPoint ) void WidgetShowNPoints::OnBackPoint(wxCommandEvent &event) { - SetCurrentPoint( GetModelShowNPoints()->GetIdCurrentPoint() + 1 ); + SetCurrentPoint( GetModelShowNPoints()->GetIdCurrentPoint() - 1 ); } void WidgetShowNPoints::OnNextPoint(wxCommandEvent &event) { - SetCurrentPoint( GetModelShowNPoints()->GetIdCurrentPoint() - 1 ); + SetCurrentPoint( GetModelShowNPoints()->GetIdCurrentPoint() + 1 ); } //------------------------------------------------------------------------ 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"); } //------------------------------------------------------------------------ @@ -613,6 +623,9 @@ void WidgetShowNPoints::OnInsertPoint_() } else {//mpoint.size printf("creaMaracasVisu::ShowNPoints (not match point) \n"); } + RefreshCollectionText(); + RefreshColourCollection(); + UndoRedo_SaveCollection(); } @@ -639,10 +652,10 @@ void WidgetShowNPoints::OnAddPoint__() // EED 2022-05-19 //renderer->GetRenderWindow()->Render(); GetViewShowNPoints()->Render(); + UndoRedo_SaveCollection(); } else {//mpoint.size printf("creaMaracasVisu::ShowNPoints (not match point) \n"); } - UndoRedo_SaveCollection(); } void WidgetShowNPoints::OnAddPoint_() @@ -664,6 +677,8 @@ void WidgetShowNPoints::AutoAddPoints() if ( cbAutoAddPoints->GetValue() == true ) { OnAddPoint__(); + RefreshCollectionText(); + RefreshColourCollection(); } // if cbAutoAddPoints } @@ -678,14 +693,12 @@ void WidgetShowNPoints::OnAutoAddPoints_tool() void WidgetShowNPoints::OnAutoAddPoints_() { StopTrackPoint(); - printf("EED WidgetShowNPoints::OnAutoAddPoints_ \n"); } //------------------------------------------------------------------------ void WidgetShowNPoints::OnAutoAddPoints(wxCommandEvent& event) { StopTrackPoint(); - printf("EED WidgetShowNPoints::OnAutoAddPoints \n"); } //------------------------------------------------------------------------ @@ -699,7 +712,13 @@ void WidgetShowNPoints::StopAutoAddPoints( ) { //EED renderer->GetRenderWindow()->Render(); wxString strTmp; - strTmp.Printf(_T("Nbr pnts: %d"), GetModelShowNPoints()->GetLstPointsSize() ); + wxString strTmp2; + if (GetModelShowNPoints()->GetIdCurrentPoint()<0) + { + strTmp2.Printf(_T(" -- / %d") , GetModelShowNPoints()->GetLstPointsSize() ); + } else { + strTmp.Printf(_T(" %d / %d"), GetModelShowNPoints()->GetIdCurrentPoint()+1 , GetModelShowNPoints()->GetLstPointsSize() ); + }// if IdCurrent<0 txtNrPoints->SetLabel( strTmp ); //--BBTK @@ -797,7 +816,9 @@ void WidgetShowNPoints::OnSetPoint_() StopAutoAddPoints(); StopTrackPoint(); - int id=GetModelShowNPoints()->GetNearestPoint(); + //int id=GetModelShowNPoints()->GetNearestPoint(); + int id=GetModelShowNPoints()->GetIdCurrentPoint(); + if((id==-1) && (mtype==1)) { id=0; @@ -813,6 +834,8 @@ void WidgetShowNPoints::OnSetPoint_() GetViewShowNPoints()->RefreshPoint(id); GetViewShowNPoints()->Render(); } // if id + RefreshCollectionText(); + RefreshColourCollection(); SetOutputBox(); UndoRedo_SaveCollection(); } @@ -823,6 +846,131 @@ void WidgetShowNPoints::OnSetPoint(wxCommandEvent& event) OnSetPoint_(); } +//------------------------------------------------------------------------ +void WidgetShowNPoints::MovePoint_(double step) +{ + step=step*2; + + StopAutoAddPoints(); + StopTrackPoint(); + + int id=GetModelShowNPoints()->GetIdCurrentPoint(); + if (aux_mesh!=NULL) + { + if((GetLstModelShowNPointsSize()>=2) //Check condition + && (GetModelShowNPoints()->GetLstPointsSize()>0) + && (aux_mesh != NULL) + && (aux_mesh_spc.size() == 3)) + { + double x,y,z; + double p[3]; + double normal[3];; // point to modify and normal + std::vector pN(3); // new point + vtkStaticPointLocator *pointLocator = vtkStaticPointLocator::New(); + pointLocator->SetDataSet( aux_mesh ); + pointLocator->BuildLocator(); + + // int idControlPoint = wsp->GetModelShowNPoints()->GetNearestPoint(); + int idControlPoint = GetModelShowNPoints()->GetIdCurrentPoint(); + + if(idControlPoint >= 0) + { + GetModelShowNPoints()->GetIdPoint(idControlPoint, &x, &y, &z); + p[0] = x * aux_mesh_spc[0]; + p[1] = y * aux_mesh_spc[1]; + p[2] = z * aux_mesh_spc[2]; + int idMeshPoint = pointLocator->FindClosestPoint(p); + aux_mesh->GetPointData()->GetNormals()->GetTuple(idMeshPoint, normal); + int direction = step; +// pN[0] = p[0] / spc[0] + direction*normal[0]; +// pN[1] = p[1] / spc[1] + direction*normal[1]; +// pN[2] = p[2] / spc[2] + direction*normal[2]; + pN[0] = x + direction*normal[0]; + pN[1] = y + direction*normal[1]; + pN[2] = z + direction*normal[2]; + + GetModelShowNPoints()->SetPointById(idControlPoint, pN); + // GetViewShowNPoints()->RefreshPoint(idControlPoint); +// RefreshCollectionText(); +// RefreshColourCollection(); +// SetOutputBox(); + UndoRedo_SaveCollection(); + } // if idControlPoint + } // if wsp->GetLstModelShowNPointsSiz->size()>=2 + + } else { + printf("EED WidgetShowNPoints::MovePoint_ BB \n" ); + if (id>=0) { + int i,j,sizeG,sizeP; + double max=100000; + double minX=max,minY=max,minZ=max; + double maxX=-max,maxY=-max,maxZ=-max; + sizeG = lstModelShowNPoints.size(); + for (i=0; i lstX = lstModelShowNPoints[i]->GetLstPointsX(); + std::vector lstY = lstModelShowNPoints[i]->GetLstPointsY(); + std::vector lstZ = lstModelShowNPoints[i]->GetLstPointsZ(); + sizeP=lstX.size(); + for (j=0; jmaxX ) { maxX=lstX[j]; } + if ( lstY[j]>maxY ) { maxY=lstY[j]; } + if ( lstZ[j]>maxZ ) { maxZ=lstZ[j]; } + } // for j + } // for i + double pc[3]; + pc[0]=(minX+maxX) /2 ; pc[1]=(minY+maxY) /2 ; pc[2]=(minZ+maxZ) /2 ; + double p[3]; + p[0]=GetModelShowNPoints()->GetLstPointsX()[id]; + p[1]=GetModelShowNPoints()->GetLstPointsY()[id]; + p[2]=GetModelShowNPoints()->GetLstPointsZ()[id]; + double v[3]; + v[0] = p[0]-pc[0]; + v[1] = p[1]-pc[1]; + v[2] = p[2]-pc[2]; + double mag=sqrt ( v[0]*v[0] + v[1]*v[1] + v[2]*v[2] ); + + std::vector point; + if (mag!=0) + { + v[0] = v[0]/mag; + v[1] = v[1]/mag; + v[2] = v[2]/mag; + } else { + v[0] = 0; + v[1] = 0; + v[2] = 0; + }// if mag + point.push_back( p[0] + step*v[0] ); + point.push_back( p[1] + step*v[1] ); + point.push_back( p[2] + step*v[2] ); + GetModelShowNPoints()->SetPointById(id,point); + UndoRedo_SaveCollection(); + + } // if id + + } // if aux_mesh + + RefreshCollectionText(); + RefreshColourCollection(); +} + +//------------------------------------------------------------------------ +void WidgetShowNPoints::OnMovePointUp(wxCommandEvent& event) +{ + MovePoint_(-1); +} + +//------------------------------------------------------------------------ +void WidgetShowNPoints::OnMovePointDown(wxCommandEvent& event) +{ + MovePoint_(+1); +} + //------------------------------------------------------------------------ void WidgetShowNPoints::TrackingPoint( ) { @@ -837,8 +985,12 @@ void WidgetShowNPoints::TrackingPoint( ) if (idTrack>=0) { GetModelShowNPoints()->SetPointId_mReferencePoint(idTrack); - GetViewShowNPoints()->RefreshPoint(idTrack); - GetViewShowNPoints()->Render(); + + RefreshCollectionText(); + RefreshColourCollection(); + +// GetViewShowNPoints()->RefreshPoint(idTrack); +// GetViewShowNPoints()->Render(); UndoRedo_SaveCollection(); } // if id } // if trackPointFlag @@ -859,14 +1011,15 @@ void WidgetShowNPoints::OnTrackPoint_() idTrack = -1; if ( cbTrackPoint->GetValue() == true ) { - idTrack = GetModelShowNPoints()->IdInsidePoint(); + // EED 2023-06-23 +// idTrack = GetModelShowNPoints()->IdInsidePoint(); + idTrack = GetModelShowNPoints()->GetIdCurrentPoint(); } // if trackPointFlag } //------------------------------------------------------------------------ void WidgetShowNPoints::OnTrackPoint(wxCommandEvent& event) { - printf("WidgetShowNPoints::OnTrackPoint \n"); OnTrackPoint_(); } @@ -894,10 +1047,11 @@ void WidgetShowNPoints::StopTrackPoint( ) } //------------------------------------------------------------------------ - void WidgetShowNPoints::ErasePoint(int id) + bool WidgetShowNPoints::ErasePoint(int id) { // EED 2022-05-19 //if (this->renderer!=NULL) + bool ok=false; if (GetViewShowNPoints()->renderer!=NULL) { if (id>=0) @@ -913,8 +1067,10 @@ void WidgetShowNPoints::StopTrackPoint( ) //lstSourceSphere.erase( lstSourceSphere.begin()+id ); GetViewShowNPoints()->ErasePoint(id); GetModelShowNPoints()->ErasePoint(id); + ok=true; } // if id } // if renderer + return ok; } //------------------------------------------------------------------------ @@ -923,13 +1079,18 @@ void WidgetShowNPoints::StopTrackPoint( ) StopAutoAddPoints(); StopTrackPoint(); - ErasePoint( GetModelShowNPoints()->IdInsidePoint() ); - SetOutputBox(); - // EED 2022-05-19 - //renderer->GetRenderWindow()->Render(); - GetViewShowNPoints()->Render(); - StopTrackPoint(); - UndoRedo_SaveCollection(); + //ErasePoint( GetModelShowNPoints()->IdInsidePoint() ); + if (ErasePoint( GetModelShowNPoints()->GetIdCurrentPoint() ) == true) + { + SetOutputBox(); + // EED 2022-05-19 + //renderer->GetRenderWindow()->Render(); + // GetViewShowNPoints()->Render(); + RefreshCollectionText(); + RefreshColourCollection(); + StopTrackPoint(); + UndoRedo_SaveCollection(); + } } //------------------------------------------------------------------------ @@ -949,6 +1110,10 @@ void WidgetShowNPoints::StopTrackPoint( ) int id = GetViewShowNPoints()->lstActorsSphere.size()-1; ErasePoint( id ); + + RefreshCollectionText(); + RefreshColourCollection(); + UndoRedo_SaveCollection(); GetViewShowNPoints()->Render(); SetOutputBox(); @@ -1224,11 +1389,16 @@ void WidgetShowNPoints::OnInsertCollectionAfter(wxCommandEvent &event) 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) ) + int c1 = mActualCollection-1; + int c2 = mActualCollection+1; + int modelSize = lstModelShowNPoints.size(); + if (aux_mesh_type==2) // SplineClose2 + { + if (c1==-1) { c1=modelSize-1; } + if (c2==modelSize) { c2=0; } + } // if aux_mesh_type + + if ( (c1!=c2) && (c1>=0) && (c1=0) && (c2 c1LstX = lstModelShowNPoints[c1]->GetLstPointsX(); std::vector c1LstY = lstModelShowNPoints[c1]->GetLstPointsY(); @@ -1245,7 +1415,7 @@ void WidgetShowNPoints::CreatePointsIntoNewCollection() creaContoursFactory f; manualContourModel *m; double x,y,z; - int i,size; + int i,ii,size; int sc; // sizeContour if ( (c1LstX.size()!=0) && (c2LstX.size()!=0) ) @@ -1290,25 +1460,50 @@ void WidgetShowNPoints::CreatePointsIntoNewCollection() } // 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,""); + vtkPoints *points; + vtkStaticPointLocator *pointLocator; + if (aux_mesh!=NULL) + { + points = aux_mesh->GetPoints(); + pointLocator = vtkStaticPointLocator::New(); + pointLocator->SetDataSet( aux_mesh ); + pointLocator->BuildLocator(); + vtkPoints *points = aux_mesh->GetPoints(); + vtkStaticPointLocator *pointLocator = vtkStaticPointLocator::New(); + pointLocator->SetDataSet( aux_mesh ); + pointLocator->BuildLocator(); + } // if aux_mesh + + double p[3], pM[3]; + if ( c1LstX.size()GetPoint( pointLocator->FindClosestPoint(p) , pM ); +// x = pM[0] / aux_mesh_spc[0]; +// y = pM[1] / aux_mesh_spc[1]; +// z = pM[2] / aux_mesh_spc[2]; + } // aux_mesh + + AddPoint(x,y,z,""); + } + pointLocator->Delete(); RefreshCollectionText(); RefreshColourCollection(); - - } // if size of c1LstX c2LstX } // if c1 && c2 - } - - //------------------------------------------------------------------------ void WidgetShowNPoints::DeleteCollection_() { @@ -1772,7 +1967,6 @@ void WidgetShowNPoints::OnInvertLstPoints_() { StopAutoAddPoints(); StopTrackPoint(); - InvertLstPoints_(); SetOutputBox(); UndoRedo_SaveCollection(); @@ -1829,4 +2023,15 @@ void WidgetShowNPoints::UndoRedo_SaveCollection() idUndoRedo++; } - +//------------------------------------------------------------------------ +void WidgetShowNPoints::SetAuxMesh(vtkPolyData* mesh, std::vector spc, std::vector params) +{ + aux_mesh = mesh; + aux_mesh_spc = spc; + if (params.size()==1) + { + aux_mesh_type = params[0]; + } else { + aux_mesh_type = 0; + }// if params size +} diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h index fed8ea6..43620f5 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h @@ -11,6 +11,9 @@ #include #include +#include "vtkPolyData.h" + + class WidgetShowNPoints : public wxPanel { @@ -73,15 +76,18 @@ class WidgetShowNPoints : public wxPanel void OnResetCollections_(); void OnResetCollections(wxCommandEvent &event); void GetCollectionPoint(int idCol,int idPoint, double *pPoint); - void SetCollectionPoint(int idCol, int idPoint, std::vector modPoint); void SetActualCollection( int actual ); - void OnUndo(wxCommandEvent &event); void OnRedo(wxCommandEvent &event); void UndoRedo_SaveCollection(); std::string GetUndoRedoFileName(); + void MovePoint_(double step); + void OnMovePointUp(wxCommandEvent& event); + void OnMovePointDown(wxCommandEvent& event); + + void RefreshCollectionText(); void RefreshColourCollection(); @@ -110,39 +116,45 @@ class WidgetShowNPoints : public wxPanel ViewShowNPoints* GetViewShowNPoints(); void SetInitLstPoints( std::vector initLstPointsX, std::vector initLstPointsY, std::vector initLstPointsZ, std::vector initLstLabels, std::vector initLstIndexs ); - void SetType(int type); - int GetType(); - double GetRadio(); - double GetOpacity(); - virtual void SetOutputBox(); - void ErasePoint(int id); + void SetType(int type); + int GetType(); + double GetRadio(); + double GetOpacity(); + virtual void SetOutputBox(); + bool ErasePoint(int id); - std::vector GetLstPointsX(); - std::vector GetLstPointsY(); - std::vector GetLstPointsZ(); - std::vector GetLstLabels(); - std::vector GetLstIndexs(); + void SetAuxMesh(vtkPolyData* , std::vector spc, std::vector params); + + std::vector GetLstPointsX(); + std::vector GetLstPointsY(); + std::vector GetLstPointsZ(); + std::vector GetLstLabels(); + std::vector GetLstIndexs(); protected: private: - std::vector lstViewShowNPoints; - //NTU: For updating points - wxStaticText * askPointLabel; - wxTextCtrl * textCtrl; - wxStaticText * txtNrCollections; - wxStaticText * txtNrPoints; - wxSlider * sdrOpacity; - wxSlider * sdrRadio; - wxCheckBox * cbTrackPoint; - wxCheckBox * cbAutoAddPoints; - - std::vector lstModelShowNPoints; - int mtype; - int mActualCollection; - int idTrack; - int idUndoRedo; - int maxUndoRedo; - std::string UndoRedoDir; + std::vector lstViewShowNPoints; + //NTU: For updating points + wxStaticText * askPointLabel; + wxTextCtrl * textCtrl; + wxStaticText * txtNrCollections; + wxStaticText * txtNrPoints; + wxSlider * sdrOpacity; + wxSlider * sdrRadio; + wxCheckBox * cbTrackPoint; + wxCheckBox * cbAutoAddPoints; + + std::vector lstModelShowNPoints; + int mtype; + int mActualCollection; + int idTrack; + int idUndoRedo; + int maxUndoRedo; + std::string UndoRedoDir; + + vtkPolyData *aux_mesh; + std::vector aux_mesh_spc; + int aux_mesh_type; }; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx index 1525055..cdd4054 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx @@ -173,8 +173,11 @@ void wxVtkMPR3DView::Configure() _wxvtk3Dbaseview->Configure(); _wxvtkmpr3DviewCntrlPanel->UpdateControlPanel(); // Actors are added to the renderer. - vtkActor* _outlineActor = _vtkmpr3Ddataviewer->GetOutlineActor(); - _wxvtk3Dbaseview->GetRenderer()->AddActor( _outlineActor ); + +//EED 2023-06-23 +// vtkActor* _outlineActor = _vtkmpr3Ddataviewer->GetOutlineActor(); +// _wxvtk3Dbaseview->GetRenderer()->AddActor( _outlineActor ); + showOutlineBoxActor(true); vtkmyPWCallback_3DPointWidget *_myCallback = vtkmyPWCallback_3DPointWidget::New(); _myCallback->SetWxVtkMPR3DView(this); @@ -282,6 +285,7 @@ void wxVtkMPR3DView::Configure() //EED 27/05/2013 // this->ResetCamera(); _wxvtk3Dbaseview->ResetCamera(); + showOutlineBoxActor(false); // Set a background color for the renderer and set the size of the // render window (expressed in pixels). diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx index 1982938..55aa58f 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx @@ -91,7 +91,7 @@ wxVtkMPR3DViewCntrlPanel::wxVtkMPR3DViewCntrlPanel(wxWindow *parent, wxVtkMPR3DV _ckBoxOutlineBox = new wxCheckBox(panel,-1,_T("Outline Box")); - _ckBoxOutlineBox->SetValue(true); + _ckBoxOutlineBox->SetValue(false); _ckBoxOutlinePlane = new wxCheckBox(panel,-1,_T("Outline Plane")); _ckBoxOutlinePlane->SetValue(true); -- 2.47.1