From 4d1cd91de0f02436faed481fac97218af98ddccf Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Wed, 31 Aug 2022 17:24:19 +0200 Subject: [PATCH] MeshManager --- bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbg | 195 ++++++++++++------ bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbs | 32 ++- ...aracasVisuInteractorStyleMaracas_Model.cxx | 77 +++++++ ...aMaracasVisuInteractorStyleMaracas_Model.h | 60 ++++++ bbtk/src/bbcreaMaracasVisuwxPopupMenu.cxx | 77 ++++--- bbtk/src/bbcreaMaracasVisuwxPopupMenu.h | 48 +++++ bbtk/src/bbmaracasvisuViewerNV.cxx | 2 +- .../wxWindows/widgets/WidgetShowNPoints.cxx | 20 +- 8 files changed, 393 insertions(+), 118 deletions(-) create mode 100644 bbtk/src/bbcreaMaracasVisuInteractorStyleMaracas_Model.cxx create mode 100644 bbtk/src/bbcreaMaracasVisuInteractorStyleMaracas_Model.h diff --git a/bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbg b/bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbg index 070eb28..d18a32f 100644 --- a/bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbg +++ b/bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbg @@ -10,12 +10,28 @@ AUTHOR:info-dev@creatis.insa-lyon.fr COMPLEXBOX:TRUE COMPLEXBOXNAME:Mesh_tool_ApplySurface PACKAGENAME:creaMaracasVisu -COMPLEXOUTPUTS:1 +COMPLEXOUTPUTS:5 COMPLEX_PORT widget -180.910574:-184.919472:-900.000000 FIN_COMPLEX_PORT -COMPLEXINPUTS:11 +COMPLEX_PORT +interactorStyleMaracas +-307.873556:-187.172927:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +interactorStyleMaracas2 +-300.133711:-186.364707:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +interactorStyleMaracas3 +-293.131686:-185.645050:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +interactorStyleMaracas4 +-285.985042:-186.124821:-900.000000 +FIN_COMPLEX_PORT +COMPLEXINPUTS:13 COMPLEX_PORT render -32.390937:141.689813:-900.000000 @@ -60,7 +76,15 @@ COMPLEX_PORT meshmanagermodel -150.374274:130.740991:-900.000000 FIN_COMPLEX_PORT -BOXES:57 +COMPLEX_PORT +ActiveTool +-316.945584:134.382008:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +ExecPopupMenuBox +-291.151968:133.699669:-900.000000 +FIN_COMPLEX_PORT +BOXES:61 BOX creaMaracasVisu:ShowNPoints:showNpoints ISEXEC:FALSE @@ -96,8 +120,8 @@ FIN_BOX BOX wx:LayoutLine:Box08 ISEXEC:FALSE --183.272879:-168.695106:-900.000000 --149.952879:-171.195106:-900.000000 +-181.825547:-146.743903:-900.000000 +-148.505547:-149.243903:-900.000000 FIN_BOX BOX vtk:UpdateRender:Box11 @@ -138,16 +162,16 @@ FIN_BOX BOX creaMaracasVisu:wxPopupMenu:Box57 ISEXEC:FALSE --264.745710:81.346668:-900.000000 --242.680710:78.846668:-900.000000 +-262.817491:81.208938:-900.000000 +-240.752491:78.708938:-900.000000 PORT WithCtrlKey:"true" FIN_BOX BOX std:AddStringToVector:Box58 ISEXEC:FALSE --291.352727:106.869911:-900.000000 --266.832727:104.369911:-900.000000 +-300.509619:94.660721:-900.000000 +-275.989619:92.160721:-900.000000 PORT In0:"Add point" PORT @@ -170,14 +194,14 @@ FIN_BOX BOX creaMaracasVisu:ShowNPoints_Tools:Box60 ISEXEC:FALSE --255.324608:69.131932:-900.000000 --232.889608:66.631932:-900.000000 +-255.052281:65.047026:-900.000000 +-232.617281:62.547026:-900.000000 FIN_BOX BOX std:StringSelect:Box61 ISEXEC:FALSE --255.993648:76.032910:-900.000000 --231.473648:73.532910:-900.000000 +-257.219120:75.352092:-900.000000 +-232.699120:72.852092:-900.000000 PORT In0:"5" PORT @@ -214,8 +238,8 @@ FIN_BOX BOX creaVtk:BooleanOperationPolyDataFilter:Box77 ISEXEC:FALSE --84.476321:-26.264040:-900.000000 --60.746321:-28.764040:-900.000000 +-85.374508:-27.219172:-900.000000 +-61.644508:-29.719172:-900.000000 PORT BoxProcessMode:"Manual" PORT @@ -237,13 +261,13 @@ ISEXEC:FALSE PORT Orientation:"H" PORT -WinTitle:"New Surface ( Magenta = Red+Yelow )" +WinTitle:"New Surface ( Magenta = Red+Yellow )" FIN_BOX BOX wx:CommandButton:Box80 ISEXEC:FALSE --107.452047:-5.305678:-900.000000 --85.177047:-7.805678:-900.000000 +-106.734755:-4.110191:-900.000000 +-84.459755:-6.610191:-900.000000 PORT Label:"Run" FIN_BOX @@ -300,8 +324,8 @@ FIN_BOX BOX creaMaracasVisu:PolyDataToActor_Widget:Box37 ISEXEC:FALSE --62.146849:-38.004259:-900.000000 --39.126849:-40.504259:-900.000000 +-70.983574:-39.626565:-900.000000 +-47.963574:-42.126565:-900.000000 PORT color:"0 1 1" FIN_BOX @@ -313,33 +337,33 @@ ISEXEC:FALSE PORT Orientation:"H" PORT -WinTitle:"Interpolated Surface (Yelow)" +WinTitle:"Interpolated Surface (Yellow)" FIN_BOX BOX wx:LayoutTab:Box39 ISEXEC:FALSE --192.270158:-93.367955:-900.000000 --158.950158:-95.867955:-900.000000 +-195.888488:-89.508403:-900.000000 +-162.568488:-92.008403:-900.000000 FIN_BOX BOX wx:LayoutTab:Box40 ISEXEC:FALSE --149.066535:-91.692070:-900.000000 --115.746535:-94.192070:-900.000000 +-148.825313:-89.038628:-900.000000 +-115.505313:-91.538628:-900.000000 FIN_BOX BOX wx:LayoutLine:Box41 ISEXEC:FALSE --133.181463:-130.594259:-900.000000 --99.861463:-133.094259:-900.000000 +-132.457797:-123.598821:-900.000000 +-99.137797:-126.098821:-900.000000 PORT Orientation:"H" FIN_BOX BOX wx:CommandButton:Box42 ISEXEC:FALSE --117.665938:-115.252338:-900.000000 --95.390938:-117.752338:-900.000000 +-117.665938:-114.769894:-900.000000 +-95.390938:-117.269894:-900.000000 PORT Label:"Apply ( Magenta -> To Red)" FIN_BOX @@ -414,14 +438,14 @@ FIN_BOX BOX std:MultipleInputs:Box53 ISEXEC:FALSE --94.857805:-12.097761:-900.000000 --72.887805:-14.597761:-900.000000 +-96.292390:-13.293248:-900.000000 +-74.322390:-15.793248:-900.000000 FIN_BOX BOX std:MultipleInputs:Box55 ISEXEC:FALSE --56.216962:-150.487985:-900.000000 --34.246962:-152.987985:-900.000000 +-55.260572:-155.987226:-900.000000 +-33.290572:-158.487226:-900.000000 FIN_BOX BOX creaMaracasVisu:MeshContours_Widget:Box62 @@ -464,16 +488,16 @@ FIN_BOX BOX creaMaracasVisu:MeshContours_Widget:Box72 ISEXEC:FALSE --254.811809:-43.192382:-900.000000 --232.016809:-45.692382:-900.000000 +-180.819147:-56.018495:-900.000000 +-158.024147:-58.518495:-900.000000 PORT colorMesh:"0 1 1" FIN_BOX BOX wx:LayoutLine:Box74 ISEXEC:FALSE --137.945645:-140.591346:-900.000000 --104.625645:-143.091346:-900.000000 +-142.287641:-131.666131:-900.000000 +-108.967641:-134.166131:-900.000000 PORT Orientation:"V" PORT @@ -482,14 +506,14 @@ FIN_BOX BOX wx:LayoutTab:Box76 ISEXEC:FALSE --172.432410:-150.170211:-900.000000 --139.112410:-152.670211:-900.000000 +-172.673632:-139.797664:-900.000000 +-139.353632:-142.297664:-900.000000 FIN_BOX BOX wx:LayoutLine:Box81 ISEXEC:FALSE --187.629585:-135.160048:-900.000000 --154.309585:-137.660048:-900.000000 +-184.734921:-96.564525:-900.000000 +-151.414921:-99.064525:-900.000000 PORT WinTitle:"Step 1. Surface" FIN_BOX @@ -514,8 +538,8 @@ FIN_BOX BOX wx:OutputText:Box85 ISEXEC:FALSE --145.099904:-118.194407:-900.000000 --123.429904:-120.694407:-900.000000 +-145.823570:-111.198969:-900.000000 +-124.153570:-113.698969:-900.000000 FIN_BOX BOX wx:LayoutTab:Box86 @@ -535,7 +559,33 @@ ISEXEC:FALSE -31.367033:-49.235762:-900.000000 -9.697033:-51.735762:-900.000000 FIN_BOX -CONNECTIONS:117 +BOX +std:MagicBox:Box89 +ISEXEC:FALSE +-331.175148:121.706470:-900.000000 +-309.575148:119.206470:-900.000000 +FIN_BOX +BOX +std:MagicBox:Box90 +ISEXEC:FALSE +-298.351639:123.000593:-900.000000 +-276.751639:120.500593:-900.000000 +FIN_BOX +BOX +creaVtk:MeshManager:Box92 +ISEXEC:FALSE +-56.608588:-81.789032:-900.000000 +-34.578588:-84.289032:-900.000000 +FIN_BOX +BOX +creaVtk:MeshManager_tool:Box93 +ISEXEC:FALSE +-61.627153:-92.643884:-900.000000 +-39.127153:-95.143884:-900.000000 +PORT +Tool:"35" +FIN_BOX +CONNECTIONS:126 CONNECTION Box06:LstContourPointsX:Box04:LstX NumberOfControlPoints:0 @@ -678,18 +728,12 @@ CONNECTION Box34:BoxChange:Box31:In2 NumberOfControlPoints:0 CONNECTION -Box57:BoxChange:Box08:BoxExecute -NumberOfControlPoints:0 -CONNECTION Box04:Out:Box77:In2 NumberOfControlPoints:0 CONNECTION title:title:Box08:WinTitle NumberOfControlPoints:0 CONNECTION -Box77:Out:Box37:polydata -NumberOfControlPoints:0 -CONNECTION Box66:Out:Box37:render NumberOfControlPoints:0 CONNECTION @@ -753,9 +797,6 @@ CONNECTION Box43:BoxChange:Box53:In6 NumberOfControlPoints:0 CONNECTION -Box77:BoxChange:Box37:boxexecute -NumberOfControlPoints:0 -CONNECTION boxChange:boxChange:Box63:In NumberOfControlPoints:0 CONNECTION @@ -816,12 +857,6 @@ CONNECTION Box69:Out:Box72:_wxvtkbaseview2D3 NumberOfControlPoints:0 CONNECTION -Box63:BoxChange:Box72:_execute -NumberOfControlPoints:0 -CONNECTION -Box77:Out:Box72:_polydata -NumberOfControlPoints:0 -CONNECTION Box41:Widget:Box74:Widget5 NumberOfControlPoints:0 CONNECTION @@ -887,4 +922,46 @@ NumberOfControlPoints:0 CONNECTION Box34:Widget:Box50:Widget4 NumberOfControlPoints:0 +CONNECTION +ActiveTool:ActiveTool:Box89:In +NumberOfControlPoints:0 +CONNECTION +ExecPopupMenuBox:ExecPopupMenuBox:Box90:In +NumberOfControlPoints:0 +CONNECTION +Box89:Out:Box57:Active +NumberOfControlPoints:0 +CONNECTION +Box57:BoxChange:Box08:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box57:InteractorStyleMaracas:interactorStyleMaracas:interactorStyleMaracas +NumberOfControlPoints:0 +CONNECTION +Box57:InteractorStyleMaracas2:interactorStyleMaracas2:interactorStyleMaracas2 +NumberOfControlPoints:0 +CONNECTION +Box57:InteractorStyleMaracas3:interactorStyleMaracas3:interactorStyleMaracas3 +NumberOfControlPoints:0 +CONNECTION +Box57:InteractorStyleMaracas4:interactorStyleMaracas4:interactorStyleMaracas4 +NumberOfControlPoints:0 +CONNECTION +Box92:MeshManagerModel:Box93:MeshManagerModel +NumberOfControlPoints:0 +CONNECTION +Box77:Out:Box93:Mesh +NumberOfControlPoints:0 +CONNECTION +Box77:BoxChange:Box93:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box92:MeshBase:Box72:_polydata +NumberOfControlPoints:0 +CONNECTION +Box92:MeshBase:Box37:polydata +NumberOfControlPoints:0 +CONNECTION +Box37:boxchange:Box72:_execute +NumberOfControlPoints:0 APP_END diff --git a/bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbs b/bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbs index bd4dd90..9a0eb7e 100644 --- a/bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbs +++ b/bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbs @@ -88,7 +88,7 @@ new wx:ComboBox Box78 new wx:LayoutLine Box79 set Box79.Orientation "H" - set Box79.WinTitle "New Surface ( Magenta = Red+Yelow )" + set Box79.WinTitle "New Surface ( Magenta = Red+Yellow )" new wx:CommandButton Box80 set Box80.Label "Run" @@ -117,7 +117,7 @@ new creaMaracasVisu:PolyDataToActor_Widget Box37 new wx:LayoutLine Box38 set Box38.Orientation "H" - set Box38.WinTitle "Interpolated Surface (Yelow)" + set Box38.WinTitle "Interpolated Surface (Yellow)" new wx:LayoutTab Box39 @@ -198,6 +198,15 @@ new wx:OutputText Box87 new wx:OutputText Box88 +new std:MagicBox Box89 + +new std:MagicBox Box90 + +new creaVtk:MeshManager Box92 + +new creaVtk:MeshManager_tool Box93 + set Box93.Tool "35" + connect Box06.LstContourPointsX Box04.LstX connect showNpoints.lstIndexs Box06.LstIndexsIn @@ -241,9 +250,7 @@ connect Box35.Out showNpoints.Image connect Box34.Out Box36.In1 connect Box36.Out Box30.Opacity connect Box34.BoxChange Box31.In2 -connect Box57.BoxChange Box08.BoxExecute connect Box04.Out Box77.In2 -connect Box77.Out Box37.polydata connect Box66.Out Box37.render connect Box38.Widget Box39.Widget2 connect Box79.Widget Box40.Widget2 @@ -264,7 +271,6 @@ connect Box42.BoxChange Box53.In3 connect Box43.BoxChange Box55.BoxExecute connect Box52.BoxChange Box55.In2 connect Box43.BoxChange Box53.In6 -connect Box77.BoxChange Box37.boxexecute connect Box63.BoxChange showNpoints.BoxExecute connect Box63.BoxChange Box62._execute connect Box64.Out Box57.wxVtkBaseView2 @@ -280,8 +286,6 @@ connect Box71.Out Box72._wxvtkbaseview3D1 connect Box64.Out Box72._wxvtkbaseview2D1 connect Box65.Out Box72._wxvtkbaseview2D2 connect Box69.Out Box72._wxvtkbaseview2D3 -connect Box63.BoxChange Box72._execute -connect Box77.Out Box72._polydata connect Box41.Widget Box74.Widget5 connect Box72._widget Box79.Widget6 connect Box37.widget Box79.Widget4 @@ -304,6 +308,14 @@ connect Box87.Widget Box50.Widget8 connect Box88.Widget Box50.Widget9 connect Box49.Widget Box50.Widget2 connect Box34.Widget Box50.Widget4 +connect Box89.Out Box57.Active +connect Box57.BoxChange Box08.BoxExecute +connect Box92.MeshManagerModel Box93.MeshManagerModel +connect Box77.Out Box93.Mesh +connect Box77.BoxChange Box93.BoxExecute +connect Box92.MeshBase Box72._polydata +connect Box92.MeshBase Box37.polydata +connect Box37.boxchange Box72._execute # Complex input ports input render Box66.In " " @@ -317,9 +329,15 @@ input wxvtkbaseview2 Box64.In " " input wxvtkbaseview3 Box65.In " " input wxvtkbaseview4 Box69.In " " input wxvtkbaseview1 Box71.In " " +input ActiveTool Box89.In " " +input ExecPopupMenuBox Box90.In " " # Complex output ports output widget Box08.Widget " " +output interactorStyleMaracas Box57.InteractorStyleMaracas " " +output interactorStyleMaracas2 Box57.InteractorStyleMaracas2 " " +output interactorStyleMaracas3 Box57.InteractorStyleMaracas3 " " +output interactorStyleMaracas4 Box57.InteractorStyleMaracas4 " " endefine diff --git a/bbtk/src/bbcreaMaracasVisuInteractorStyleMaracas_Model.cxx b/bbtk/src/bbcreaMaracasVisuInteractorStyleMaracas_Model.cxx new file mode 100644 index 0000000..6415f74 --- /dev/null +++ b/bbtk/src/bbcreaMaracasVisuInteractorStyleMaracas_Model.cxx @@ -0,0 +1,77 @@ +//===== +// 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) +//===== +#include "bbcreaMaracasVisuInteractorStyleMaracas_Model.h" +#include "bbcreaMaracasVisuPackage.h" +namespace bbcreaMaracasVisu +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,InteractorStyleMaracas_Model) +BBTK_BLACK_BOX_IMPLEMENTATION(InteractorStyleMaracas_Model,bbtk::AtomicBlackBox); +//===== +// 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 InteractorStyleMaracas_Model::Process() +{ +// THE MAIN PROCESSING METHOD BODY +// Here we simply set the input 'In' value to the output 'Out' +// And print out the output value +// INPUT/OUTPUT ACCESSORS ARE OF THE FORM : +// void bbSet{Input|Output}NAME(const TYPE&) +// const TYPE& bbGet{Input|Output}NAME() const +// Where : +// * NAME is the name of the input/output +// (the one provided in the attribute 'name' of the tag 'input') +// * TYPE is the C++ type of the input/output +// (the one provided in the attribute 'type' of the tag 'input') +// bbSetOutputOut( bbGetInputIn() ); +// std::cout << "Output value = " <SetActive( bbGetInputActive() ); } + if (bbGetInputInteractorStyleMaracas2()!=NULL) { bbGetInputInteractorStyleMaracas2()->SetActive( bbGetInputActive() ); } + if (bbGetInputInteractorStyleMaracas3()!=NULL) { bbGetInputInteractorStyleMaracas3()->SetActive( bbGetInputActive() ); } + if (bbGetInputInteractorStyleMaracas4()!=NULL) { bbGetInputInteractorStyleMaracas4()->SetActive( bbGetInputActive() ); } +} +//===== +// 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 InteractorStyleMaracas_Model::bbUserSetDefaultValues() +{ + +// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX +// Here we initialize the input 'In' to 0 + bbSetInputActive(true); + bbSetInputInteractorStyleMaracas(NULL); + bbSetInputInteractorStyleMaracas2(NULL); + bbSetInputInteractorStyleMaracas3(NULL); + bbSetInputInteractorStyleMaracas4(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 InteractorStyleMaracas_Model::bbUserInitializeProcessing() +{ + +// THE INITIALIZATION METHOD BODY : +// Here does nothing +// but this is where you should allocate the internal/output pointers +// if any + + +} +//===== +// 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 InteractorStyleMaracas_Model::bbUserFinalizeProcessing() +{ + +// THE FINALIZATION METHOD BODY : +// Here does nothing +// but this is where you should desallocate the internal/output pointers +// if any + +} +} +// EO namespace bbcreaMaracasVisu + + diff --git a/bbtk/src/bbcreaMaracasVisuInteractorStyleMaracas_Model.h b/bbtk/src/bbcreaMaracasVisuInteractorStyleMaracas_Model.h new file mode 100644 index 0000000..b9f1c8e --- /dev/null +++ b/bbtk/src/bbcreaMaracasVisuInteractorStyleMaracas_Model.h @@ -0,0 +1,60 @@ +//===== +// 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) +//===== +#ifndef __bbcreaMaracasVisuInteractorStyleMaracas_Model_h_INCLUDED__ +#define __bbcreaMaracasVisuInteractorStyleMaracas_Model_h_INCLUDED__ + +#include "bbcreaMaracasVisu_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +#include "InteractorStyleMaracas.h" + + +namespace bbcreaMaracasVisu +{ + +class bbcreaMaracasVisu_EXPORT InteractorStyleMaracas_Model + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(InteractorStyleMaracas_Model,bbtk::AtomicBlackBox); +//===== +// 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) +//===== + BBTK_DECLARE_INPUT(Active,bool); + BBTK_DECLARE_INPUT(InteractorStyleMaracas,InteractorStyleMaracas*); + BBTK_DECLARE_INPUT(InteractorStyleMaracas2,InteractorStyleMaracas*); + BBTK_DECLARE_INPUT(InteractorStyleMaracas3,InteractorStyleMaracas*); + BBTK_DECLARE_INPUT(InteractorStyleMaracas4,InteractorStyleMaracas*); +// BBTK_DECLARE_OUTPUT(Out,double); + BBTK_PROCESS(Process); + void Process(); +//===== +// 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) +//===== +}; + +BBTK_BEGIN_DESCRIBE_BLACK_BOX(InteractorStyleMaracas_Model,bbtk::AtomicBlackBox); + BBTK_NAME("InteractorStyleMaracas_Model"); + BBTK_AUTHOR("InfoDev"); + BBTK_DESCRIPTION("No Description."); + BBTK_CATEGORY("empty"); + + BBTK_INPUT(InteractorStyleMaracas_Model,Active,"(default true)",bool,""); + BBTK_INPUT(InteractorStyleMaracas_Model,InteractorStyleMaracas,"InteractorStyleMaracas",InteractorStyleMaracas*,""); + BBTK_INPUT(InteractorStyleMaracas_Model,InteractorStyleMaracas2,"InteractorStyleMaracas2",InteractorStyleMaracas*,""); + BBTK_INPUT(InteractorStyleMaracas_Model,InteractorStyleMaracas3,"InteractorStyleMaracas3",InteractorStyleMaracas*,""); + BBTK_INPUT(InteractorStyleMaracas_Model,InteractorStyleMaracas4,"InteractorStyleMaracas4",InteractorStyleMaracas*,""); + +// BBTK_OUTPUT(InteractorStyleMaracas_Model,Out,"First output",double,""); + +BBTK_END_DESCRIBE_BLACK_BOX(InteractorStyleMaracas_Model); +//===== +// 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) +//===== +} +// EO namespace bbcreaMaracasVisu + +#endif // __bbcreaMaracasVisuInteractorStyleMaracas_Model_h_INCLUDED__ + diff --git a/bbtk/src/bbcreaMaracasVisuwxPopupMenu.cxx b/bbtk/src/bbcreaMaracasVisuwxPopupMenu.cxx index 535d262..657e07d 100644 --- a/bbtk/src/bbcreaMaracasVisuwxPopupMenu.cxx +++ b/bbtk/src/bbcreaMaracasVisuwxPopupMenu.cxx @@ -6,42 +6,10 @@ #include #include -#include "InteractorStyleMaracas.h" -#include -#include "wxVtk2DBaseView.h" namespace bbcreaMaracasVisu { -class PopupMenuInteractor : public InteractorStyleMaracas , wxEvtHandler -{ - public: -// PopupMenuInteractor( ); - PopupMenuInteractor( wxPopupMenu *box, wxVtkBaseView *wxvtkbaseview ); - ~PopupMenuInteractor(); -// virtual bool OnLeftButtonDown(); -// virtual bool OnLeftButtonUp(); -// virtual bool OnMouseMove(); -// virtual bool OnRightButtonDown(); - virtual bool OnRightButtonUp(); -// virtual bool OnLeftDClick(); -// virtual bool OnRightDClick(); - void OnPopupClick(wxCommandEvent &evt); - void SetWithCtrlKey(bool flag); - private: - wxVtkBaseView *_wxvtkbaseview; - wxPopupMenu *_box; - std::vector _lstPoint; - bool _withCtrlKey; -}; - -/* -PopupMenuInteractor::PopupMenuInteractor( ) -{ - _wxvtkbaseview = NULL; - _box = NULL; -} -*/ PopupMenuInteractor::PopupMenuInteractor( wxPopupMenu *box , wxVtkBaseView *wxvtkbaseview ) { _wxvtkbaseview = wxvtkbaseview; @@ -122,6 +90,8 @@ bool PopupMenuInteractor::OnRightButtonUp() ok=true; } + ok=ok && GetActive(); + if (ok==true) { @@ -163,12 +133,14 @@ void wxPopupMenu::Process() // (the one provided in the attribute 'type' of the tag 'input') // bbSetOutputOut( bbGetInputIn() ); // std::cout << "Output value = " <SetWithCtrlKey( bbGetInputWithCtrlKey() ); vtkInteractorStyleBaseView *vtkinteractorstylebaseview = (vtkInteractorStyleBaseView*) (bbGetInputwxVtkBaseView()->GetInteractorStyleBaseView() ); vtkinteractorstylebaseview->AddInteractorStyleMaracas( popupmenuinteractor ); @@ -176,29 +148,44 @@ void wxPopupMenu::Process() if (bbGetInputwxVtkBaseView2()!=NULL) { - PopupMenuInteractor* popupmenuinteractor = new PopupMenuInteractor( this, bbGetInputwxVtkBaseView2() ); - popupmenuinteractor->SetWithCtrlKey( bbGetInputWithCtrlKey() ); + popupmenuinteractor2 = new PopupMenuInteractor( this, bbGetInputwxVtkBaseView2() ); + popupmenuinteractor2->SetWithCtrlKey( bbGetInputWithCtrlKey() ); vtkInteractorStyleBaseView *vtkinteractorstylebaseview = (vtkInteractorStyleBaseView*) (bbGetInputwxVtkBaseView2()->GetInteractorStyleBaseView() ); - vtkinteractorstylebaseview->AddInteractorStyleMaracas( popupmenuinteractor ); + vtkinteractorstylebaseview->AddInteractorStyleMaracas( popupmenuinteractor2 ); } // if wxVtkBaseView2 if (bbGetInputwxVtkBaseView3()!=NULL) { - PopupMenuInteractor* popupmenuinteractor = new PopupMenuInteractor( this, bbGetInputwxVtkBaseView3() ); - popupmenuinteractor->SetWithCtrlKey( bbGetInputWithCtrlKey() ); + popupmenuinteractor3 = new PopupMenuInteractor( this, bbGetInputwxVtkBaseView3() ); + popupmenuinteractor3->SetWithCtrlKey( bbGetInputWithCtrlKey() ); vtkInteractorStyleBaseView *vtkinteractorstylebaseview = (vtkInteractorStyleBaseView*) (bbGetInputwxVtkBaseView3()->GetInteractorStyleBaseView() ); - vtkinteractorstylebaseview->AddInteractorStyleMaracas( popupmenuinteractor ); + vtkinteractorstylebaseview->AddInteractorStyleMaracas( popupmenuinteractor3 ); } // if wxVtkBaseView3 if (bbGetInputwxVtkBaseView4()!=NULL) { - PopupMenuInteractor* popupmenuinteractor = new PopupMenuInteractor( this, bbGetInputwxVtkBaseView4() ); - popupmenuinteractor->SetWithCtrlKey( bbGetInputWithCtrlKey() ); + popupmenuinteractor4 = new PopupMenuInteractor( this, bbGetInputwxVtkBaseView4() ); + popupmenuinteractor4->SetWithCtrlKey( bbGetInputWithCtrlKey() ); vtkInteractorStyleBaseView *vtkinteractorstylebaseview = (vtkInteractorStyleBaseView*) (bbGetInputwxVtkBaseView4()->GetInteractorStyleBaseView() ); - vtkinteractorstylebaseview->AddInteractorStyleMaracas( popupmenuinteractor ); + vtkinteractorstylebaseview->AddInteractorStyleMaracas( popupmenuinteractor4 ); } // if wxVtkBaseView4 + + bbSetOutputInteractorStyleMaracas( (InteractorStyleMaracas*)popupmenuinteractor ); + bbSetOutputInteractorStyleMaracas2( (InteractorStyleMaracas*)popupmenuinteractor2 ); + bbSetOutputInteractorStyleMaracas3( (InteractorStyleMaracas*)popupmenuinteractor3 ); + bbSetOutputInteractorStyleMaracas4( (InteractorStyleMaracas*)popupmenuinteractor4 ); + } // if firsttime + + if (popupmenuinteractor !=NULL) { popupmenuinteractor ->SetActive( bbGetInputActive() ); } + if (popupmenuinteractor2!=NULL) { popupmenuinteractor2->SetActive( bbGetInputActive() ); } + if (popupmenuinteractor3!=NULL) { popupmenuinteractor3->SetActive( bbGetInputActive() ); } + if (popupmenuinteractor4!=NULL) { popupmenuinteractor4->SetActive( bbGetInputActive() ); } + + bbSetOutputOut(-1); + printf("EED wxPopupMenu::Process End \n"); + } //===== @@ -209,12 +196,18 @@ void wxPopupMenu::bbUserSetDefaultValues() // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 firsttime = true; + bbSetInputActive(true); bbSetInputwxVtkBaseView(NULL); bbSetInputwxVtkBaseView2(NULL); bbSetInputwxVtkBaseView3(NULL); bbSetInputwxVtkBaseView4(NULL); bbSetInputWithCtrlKey(false); bbSetOutputOut(-1); + + popupmenuinteractor=NULL; + popupmenuinteractor2=NULL; + popupmenuinteractor3=NULL; + popupmenuinteractor4=NULL; } //===== diff --git a/bbtk/src/bbcreaMaracasVisuwxPopupMenu.h b/bbtk/src/bbcreaMaracasVisuwxPopupMenu.h index 2a9b223..0047588 100644 --- a/bbtk/src/bbcreaMaracasVisuwxPopupMenu.h +++ b/bbtk/src/bbcreaMaracasVisuwxPopupMenu.h @@ -27,10 +27,40 @@ // EO Wx headers #include "wxVtkBaseView.h" +#include "wxVtk2DBaseView.h" +#include "InteractorStyleMaracas.h" +#include namespace bbcreaMaracasVisu { +class wxPopupMenu; + +class PopupMenuInteractor : public InteractorStyleMaracas , wxEvtHandler +{ + public: +// PopupMenuInteractor( ); + PopupMenuInteractor( wxPopupMenu *box, wxVtkBaseView *wxvtkbaseview ); + ~PopupMenuInteractor(); +// virtual bool OnLeftButtonDown(); +// virtual bool OnLeftButtonUp(); +// virtual bool OnMouseMove(); +// virtual bool OnRightButtonDown(); + virtual bool OnRightButtonUp(); +// virtual bool OnLeftDClick(); +// virtual bool OnRightDClick(); + void OnPopupClick(wxCommandEvent &evt); + void SetWithCtrlKey(bool flag); + private: + wxVtkBaseView *_wxvtkbaseview; + wxPopupMenu *_box; + std::vector _lstPoint; + bool _withCtrlKey; +}; + + + + class bbcreaMaracasVisu_EXPORT wxPopupMenu : public bbtk::AtomicBlackBox @@ -39,6 +69,7 @@ class bbcreaMaracasVisu_EXPORT wxPopupMenu //===== // 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) //===== + BBTK_DECLARE_INPUT(Active,bool); BBTK_DECLARE_INPUT(In,std::vector< std::string >); BBTK_DECLARE_INPUT(wxVtkBaseView,wxVtkBaseView*); BBTK_DECLARE_INPUT(wxVtkBaseView2,wxVtkBaseView*); @@ -49,9 +80,21 @@ class bbcreaMaracasVisu_EXPORT wxPopupMenu BBTK_DECLARE_OUTPUT(Out,int); BBTK_DECLARE_OUTPUT(Point,std::vector); BBTK_DECLARE_OUTPUT(SimpleText,std::string); + BBTK_DECLARE_OUTPUT(InteractorStyleMaracas,InteractorStyleMaracas*); + BBTK_DECLARE_OUTPUT(InteractorStyleMaracas2,InteractorStyleMaracas*); + BBTK_DECLARE_OUTPUT(InteractorStyleMaracas3,InteractorStyleMaracas*); + BBTK_DECLARE_OUTPUT(InteractorStyleMaracas4,InteractorStyleMaracas*); + BBTK_PROCESS(Process); void Process(); bool firsttime; + + + PopupMenuInteractor* popupmenuinteractor; + PopupMenuInteractor* popupmenuinteractor2; + PopupMenuInteractor* popupmenuinteractor3; + PopupMenuInteractor* popupmenuinteractor4; + //===== // 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) //===== @@ -62,6 +105,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(wxPopupMenu,bbtk::AtomicBlackBox); BBTK_AUTHOR("InfoDev"); BBTK_DESCRIPTION("No Description."); BBTK_CATEGORY("empty"); + BBTK_INPUT(wxPopupMenu,Active,"(default true) Active true/false",bool,""); BBTK_INPUT(wxPopupMenu,In,"Vector of items",std::vector< std::string >,""); // BBTK_INPUT(wxPopupMenu,Position,"Window position",std::vector< int >,""); BBTK_INPUT(wxPopupMenu,wxVtkBaseView,"wxVtkBaseView",wxVtkBaseView*,""); @@ -72,6 +116,10 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(wxPopupMenu,bbtk::AtomicBlackBox); BBTK_OUTPUT(wxPopupMenu,Point,"click point in the image",std::vector,""); BBTK_OUTPUT(wxPopupMenu,Out,"Sected item",int,""); BBTK_OUTPUT(wxPopupMenu,SimpleText,"Text selected item",std::string,""); + BBTK_OUTPUT(wxPopupMenu,InteractorStyleMaracas,"Interactor Style Maracas",InteractorStyleMaracas*,""); + BBTK_OUTPUT(wxPopupMenu,InteractorStyleMaracas2,"Interactor Style Maracas 2",InteractorStyleMaracas*,""); + BBTK_OUTPUT(wxPopupMenu,InteractorStyleMaracas3,"Interactor Style Maracas 3",InteractorStyleMaracas*,""); + BBTK_OUTPUT(wxPopupMenu,InteractorStyleMaracas4,"Interactor Style Maracas 4",InteractorStyleMaracas*,""); BBTK_END_DESCRIBE_BLACK_BOX(wxPopupMenu); //===== // 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) diff --git a/bbtk/src/bbmaracasvisuViewerNV.cxx b/bbtk/src/bbmaracasvisuViewerNV.cxx index 2dcd989..698893c 100644 --- a/bbtk/src/bbmaracasvisuViewerNV.cxx +++ b/bbtk/src/bbmaracasvisuViewerNV.cxx @@ -77,7 +77,7 @@ void bbwxMaracas_N_ViewersWidget::OnRefreshView(wxCommandEvent & event) void bbwxMaracas_N_ViewersWidget::OnDClickLeft(wxCommandEvent & event) { wxMaracas_N_ViewersWidget::OnDClickLeft(event); - mbbViewerNV->bbSignalOutputModification(std::string("Point")); +//EED 2022-08-31 mbbViewerNV->bbSignalOutputModification(std::string("Point")); } //------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx index 6d88bb9..462b1f4 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx @@ -65,18 +65,19 @@ wxButton *btnInsertCollectionBefore = new wxButton( panel2, -1, _T("+ <")); wxButton *btnInsertCollectionAfter = new wxButton( panel2, -1, _T("+ >")); wxButton *btnDeleteCollection = new wxButton( panel2, -1, _T("Delete")); + wxButton *btnResetCollection = new wxButton( panel2, -1, _T("Reset")); wxButton *btnSaveCollection = new wxButton( panel2, -1, _T("Save")); wxButton *btnLoadCollection = new wxButton( panel2, -1, _T("Load")); - wxButton *btnResetCollection = new wxButton( panel2, -1, _T("Reset")); wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1); wxFlexGridSizer *sizer2 = new wxFlexGridSizer(2); wxFlexGridSizer *sizer3 = new wxFlexGridSizer(3); wxFlexGridSizer *sizer4 = new wxFlexGridSizer(3); wxFlexGridSizer *sizer5 = new wxFlexGridSizer(2); + wxFlexGridSizer *sizer6 = new wxFlexGridSizer(2); wxStaticText* txOpacity = new wxStaticText(panel2, -1, wxString(_T("Opacity"))); wxSize sizeSlider; - sizeSlider.Set( 120 , -1 ); + sizeSlider.Set( 90 , -1 ); sdrOpacity = new wxSlider(panel2, -1, 0, 0, 100, wxDefaultPosition, sizeSlider, wxSL_LABELS); wxStaticText* txRadio = new wxStaticText(panel2, -1, wxString(_T("Radius "))); sdrRadio = new wxSlider(panel2, -1, 0, 1, 50, wxDefaultPosition, sizeSlider, wxSL_LABELS); @@ -97,18 +98,19 @@ sizer2->Add( btnNextCollection ); sizer3->Add( btnInsertCollectionBefore ); sizer3->Add( btnInsertCollectionAfter ); - sizer3->Add( btnDeleteCollection ); - sizer4->Add( btnSaveCollection ); sizer4->Add( btnLoadCollection ); - sizer4->Add( btnResetCollection ); + sizer4->Add( btnSaveCollection ); sizer5->Add( txRadio ,wxGROW ); sizer5->Add( txOpacity ,wxGROW ); sizer5->Add( sdrRadio ,wxGROW ); sizer5->Add( sdrOpacity ,wxGROW ); + sizer6->Add( btnDeleteCollection ); + sizer6->Add( btnResetCollection ); sizer1->Add( txtNrCollections ); sizer1->Add( sizer2 ); sizer1->Add( sizer3 ); + sizer1->Add( sizer6 ); sizer1->Add( sizer4 ); sizer1->Add( sizer5 ,wxGROW ); @@ -123,7 +125,7 @@ if ( (mtype==0) || (mtype==3) || (mtype==4) ) { // Widget interface - askPointLabel = new wxStaticText(panel, -1, _T("Point label :")); // JPR +// askPointLabel = new wxStaticText(panel, -1, _T("Label:")); // JPR textCtrl = new wxTextCtrl(panel, -1); wxButton *btnAddPoint = new wxButton( panel, -1, _T("Add")); wxButton *btnInsertPoint = new wxButton( panel, -1, _T("Insert"));//CFT @@ -184,12 +186,12 @@ sizer4->Add(btnEraseLastPoint); sizer4->Add(btnDeleteAllPoints); - sizer0->Add(askPointLabel); // JPR - sizer0->Add(sizer1); +// sizer0->Add(askPointLabel); // JPR + sizer0->Add(txtNrPoints); sizer0->Add(sizer2); + sizer0->Add(sizer1); sizer0->Add(sizer3); sizer0->Add(sizer4); - sizer0->Add(txtNrPoints); if ( (mtype==0) || (mtype==3) ) { -- 2.47.1