From: Eduardo DAVILA Date: Wed, 6 Sep 2023 14:12:20 +0000 (+0200) Subject: #3544 Mesh Application - Smooth - Refresh contours bug X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=9436605fbf383df5f75e44f54164dd986262688a;p=creaMaracasVisu.git #3544 Mesh Application - Smooth - Refresh contours bug --- diff --git a/bbtk/bbs/boxes/Mesh_Application.bbg b/bbtk/bbs/boxes/Mesh_Application.bbg index 21ff727..3f9c754 100644 --- a/bbtk/bbs/boxes/Mesh_Application.bbg +++ b/bbtk/bbs/boxes/Mesh_Application.bbg @@ -76,7 +76,7 @@ COMPLEX_PORT OutDir_ExMa 334.933146:91.638847:-900.000000 FIN_COMPLEX_PORT -BOXES:101 +BOXES:103 BOX creaMaracasVisu:ImageChangeInformation:Box07 ISEXEC:FALSE @@ -120,8 +120,8 @@ FIN_BOX BOX wx:LayoutTab:Box12 ISEXEC:FALSE -170.348620:-22.185391:-900.000000 -203.668620:-24.685391:-900.000000 +171.433597:-23.580361:-900.000000 +204.753597:-26.080361:-900.000000 FIN_BOX BOX creaMaracasVisu:SetPositionPointPicker:Box13 @@ -167,7 +167,7 @@ In2:"0 0 1 0 0 0 0 0" PORT In3:"0 0 0 1 0 0 0 0" PORT -In4:"0 0 0 0 0 0 0 0" +In4:"0 0 0 0 1 0 0 0" PORT In5:"0 0 0 0 0 1 0 0" PORT @@ -181,7 +181,7 @@ In9:"0 0 0 0 0 0 0 0" FIN_BOX BOX std:GetVectorStringElement:Box24 -ISEXEC:TRUE +ISEXEC:FALSE 56.321765:-38.944139:-900.000000 79.276765:-41.444139:-900.000000 PORT @@ -354,16 +354,16 @@ FIN_BOX BOX std:ConcatStrings_tool:Box57 ISEXEC:FALSE -146.272433:-49.611939:-900.000000 -168.712433:-52.111939:-900.000000 +199.910591:-52.087546:-900.000000 +222.350591:-54.587546:-900.000000 PORT Type:"1" FIN_BOX BOX std:GetVectorStringElement:Box58 ISEXEC:FALSE -148.982049:-37.179653:-900.000000 -171.937049:-39.679653:-900.000000 +201.795005:-38.830058:-900.000000 +224.750005:-41.330058:-900.000000 PORT I:"5" FIN_BOX @@ -390,8 +390,8 @@ FIN_BOX BOX std:MagicBox:Box63 ISEXEC:FALSE -264.357654:70.945031:-900.000000 -285.957654:68.445031:-900.000000 +266.330339:66.858754:-900.000000 +287.930339:64.358754:-900.000000 FIN_BOX BOX std:MagicBox:Box65 @@ -729,7 +729,7 @@ ISEXEC:FALSE FIN_BOX BOX wx:LayoutLine:Box119 -ISEXEC:FALSE +ISEXEC:TRUE 31.186709:-123.851967:-900.000000 64.506709:-126.351967:-900.000000 PORT @@ -756,16 +756,16 @@ FIN_BOX BOX creaMaracasVisu:wxVtkBaseView_Info:Box122 ISEXEC:FALSE --73.014509:-19.623895:-900.000000 --43.974509:-22.123895:-900.000000 +-72.844013:-20.476377:-900.000000 +-43.804013:-22.976377:-900.000000 PORT InteractionType:"6" FIN_BOX BOX std:MultipleInputs:Box123 ISEXEC:FALSE -77.577594:17.008898:-900.000000 -99.657594:14.508898:-900.000000 +237.348057:71.383963:-900.000000 +259.428057:68.883963:-900.000000 FIN_BOX BOX creaMaracasVisu:wxVtkBaseView_Info:Box124 @@ -842,16 +842,16 @@ FIN_BOX BOX std:GetVectorStringElement:Box135 ISEXEC:FALSE -191.007344:-37.801404:-900.000000 -214.072344:-40.301404:-900.000000 +243.820300:-39.451809:-900.000000 +266.885300:-41.951809:-900.000000 PORT I:"6" FIN_BOX BOX std:ConcatStrings_tool:Box136 ISEXEC:FALSE -191.231412:-50.269107:-900.000000 -213.781412:-52.769107:-900.000000 +244.044368:-51.919512:-900.000000 +266.594368:-54.419512:-900.000000 PORT Type:"1" FIN_BOX @@ -875,7 +875,23 @@ ISEXEC:FALSE -80.144058:-47.284744:-900.000000 -58.064058:-49.784744:-900.000000 FIN_BOX -CONNECTIONS:276 +BOX +std:ConcatStrings_tool:Box141 +ISEXEC:FALSE +160.596857:-49.485521:-900.000000 +183.146857:-51.985521:-900.000000 +PORT +Type:"1" +FIN_BOX +BOX +std:GetVectorStringElement:Box142 +ISEXEC:FALSE +159.064725:-39.037176:-900.000000 +182.129725:-41.537176:-900.000000 +PORT +I:"4" +FIN_BOX +CONNECTIONS:280 CONNECTION Box08:MeshBase:Box15:polydata NumberOfControlPoints:0 @@ -1042,9 +1058,6 @@ CONNECTION Box63:BoxChange:Box28:In4 NumberOfControlPoints:0 CONNECTION -Box63:BoxChange:Box46:boxChange -NumberOfControlPoints:0 -CONNECTION Render3D:Render3D:Box65:In NumberOfControlPoints:0 CONNECTION @@ -1704,4 +1717,19 @@ NumberOfControlPoints:0 CONNECTION Box117:transform:Box70:freeplane_transform NumberOfControlPoints:0 +CONNECTION +Box46:Active_ConcatString:Box141:Box_ConcatString +NumberOfControlPoints:0 +CONNECTION +Box23:Out:Box142:In +NumberOfControlPoints:0 +CONNECTION +Box142:Out:Box141:In1 +NumberOfControlPoints:0 +CONNECTION +Box12:BoxChange:Box141:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box123:BoxChange:Box46:boxChange +NumberOfControlPoints:0 APP_END diff --git a/bbtk/bbs/boxes/Mesh_Application.bbs b/bbtk/bbs/boxes/Mesh_Application.bbs index 1a2c593..1056dc0 100644 --- a/bbtk/bbs/boxes/Mesh_Application.bbs +++ b/bbtk/bbs/boxes/Mesh_Application.bbs @@ -51,7 +51,7 @@ new std:StringSelect Box23 set Box23.In1 "0 1 0 0 0 0 0 0" set Box23.In2 "0 0 1 0 0 0 0 0" set Box23.In3 "0 0 0 1 0 0 0 0" - set Box23.In4 "0 0 0 0 0 0 0 0" + set Box23.In4 "0 0 0 0 1 0 0 0" set Box23.In5 "0 0 0 0 0 1 0 0" set Box23.In6 "0 0 0 0 0 0 1 0" set Box23.In7 "0 0 0 0 0 0 0 0" @@ -316,6 +316,12 @@ new creaMaracasVisu:wxVtkBaseView_Info Box140 new std:MultipleInputs Box139 +new std:ConcatStrings_tool Box141 + set Box141.Type "1" + +new std:GetVectorStringElement Box142 + set Box142.I "4" + connect Box08.MeshBase Box15.polydata connect Box08.MeshTemp Box10.mesh @@ -370,7 +376,6 @@ connect Box07.Out Box61.In connect Box61.Spacing Box60.In1 connect Box54.Out Box59.Active connect Box63.BoxChange Box28.In4 -connect Box63.BoxChange Box46.boxChange connect Box65.Out Box48.Renderer connect Box65.Out Box15.render connect Box66.Out Box13.wxvtkbaseview @@ -577,6 +582,11 @@ connect Box117.transform Box46.freeplane_transform connect Box117.actualPoint Box70.freeplane_point connect Box117.boxChange Box70.freeplane_boxexecute connect Box117.transform Box70.freeplane_transform +connect Box46.Active_ConcatString Box141.Box_ConcatString +connect Box23.Out Box142.In +connect Box142.Out Box141.In1 +connect Box12.BoxChange Box141.BoxExecute +connect Box123.BoxChange Box46.boxChange # Complex input ports input MeshIn Box56.In " " @@ -598,6 +608,6 @@ output freeplane_Point Box117.actualPoint " " output freeplane_Transform Box117.transform " " output freeplane_BoxChange Box117.boxChange " " -exec Box24 +exec Box119 endefine diff --git a/bbtk/bbs/boxes/Mesh_tool_ApplySmooth.bbg b/bbtk/bbs/boxes/Mesh_tool_ApplySmooth.bbg index d7f0b02..fc7f657 100644 --- a/bbtk/bbs/boxes/Mesh_tool_ApplySmooth.bbg +++ b/bbtk/bbs/boxes/Mesh_tool_ApplySmooth.bbg @@ -10,10 +10,14 @@ AUTHOR:info-dev@creatis.insa-lyon.fr COMPLEXBOX:TRUE COMPLEXBOXNAME:Mesh_tool_ApplySmooth PACKAGENAME:creaMaracasVisu -COMPLEXOUTPUTS:1 +COMPLEXOUTPUTS:2 COMPLEX_PORT widget --190.515959:-183.832070:-900.000000 +-191.180457:-224.034222:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +Active_ConcatString +-222.946549:-229.201962:-900.000000 FIN_COMPLEX_PORT COMPLEXINPUTS:12 COMPLEX_PORT @@ -64,18 +68,18 @@ COMPLEX_PORT freeplane_transform -345.215759:132.966466:-900.000000 FIN_COMPLEX_PORT -BOXES:46 +BOXES:48 BOX wx:LayoutLine:Box08 ISEXEC:FALSE --192.579846:-162.823711:-900.000000 --159.259846:-165.323711:-900.000000 +-193.244344:-203.025863:-900.000000 +-159.924344:-205.525863:-900.000000 FIN_BOX BOX vtk:UpdateRender:Box11 ISEXEC:FALSE --3.524466:-92.590891:-900.000000 -18.500534:-95.090891:-900.000000 +-4.188964:-132.793043:-900.000000 +17.836036:-135.293043:-900.000000 PORT Active:"true" FIN_BOX @@ -88,8 +92,8 @@ FIN_BOX BOX wx:LayoutLine:Box79 ISEXEC:FALSE --145.576309:-116.178854:-900.000000 --112.256309:-118.678854:-900.000000 +-146.240807:-156.381006:-900.000000 +-112.920807:-158.881006:-900.000000 PORT Orientation:"H" PORT @@ -134,8 +138,8 @@ FIN_BOX BOX wx:LayoutTab:Box40 ISEXEC:FALSE --183.624446:-140.700463:-900.000000 --150.304446:-143.200463:-900.000000 +-184.288944:-180.902615:-900.000000 +-150.968944:-183.402615:-900.000000 FIN_BOX BOX wx:CommandButton:Box42 @@ -166,8 +170,8 @@ FIN_BOX BOX creaVtk:MeshManager_tool:Box45 ISEXEC:FALSE --88.859950:-132.940417:-900.000000 --66.359950:-135.440417:-900.000000 +-89.524448:-173.142569:-900.000000 +-67.024448:-175.642569:-900.000000 PORT Tool:"30" FIN_BOX @@ -180,8 +184,8 @@ FIN_BOX BOX std:MultipleInputs:Box51 ISEXEC:FALSE --92.949669:-148.627142:-900.000000 --70.979669:-151.127142:-900.000000 +-93.614167:-188.829294:-900.000000 +-71.644167:-191.329294:-900.000000 FIN_BOX BOX std:MagicBox:Box63 @@ -216,18 +220,16 @@ FIN_BOX BOX creaMaracasVisu:MeshContours_Widget:Box72 ISEXEC:FALSE --149.274624:-67.610228:-900.000000 --126.479624:-70.110228:-900.000000 -PORT -active_widget:"1" +-123.753071:-111.420601:-900.000000 +-100.958071:-113.920601:-900.000000 PORT colorMesh:"0 1 1" FIN_BOX BOX wx:LayoutLine:Box81 ISEXEC:FALSE --187.139985:-150.923661:-900.000000 --153.819985:-153.423661:-900.000000 +-187.804483:-191.125813:-900.000000 +-154.484483:-193.625813:-900.000000 PORT WinTitle:"Step 1. Surface" FIN_BOX @@ -310,16 +312,16 @@ FIN_BOX BOX creaVtk:MeshManager_tool:Box47 ISEXEC:FALSE --61.032649:-131.853919:-900.000000 --38.532649:-134.353919:-900.000000 +-61.697147:-172.056071:-900.000000 +-39.197147:-174.556071:-900.000000 PORT Tool:"35" FIN_BOX BOX creaVtk:MeshManager_tool:Box48 ISEXEC:FALSE --31.571613:-131.892967:-900.000000 --9.071613:-134.392967:-900.000000 +-32.236111:-172.095119:-900.000000 +-9.736111:-174.595119:-900.000000 PORT Tool:"35" FIN_BOX @@ -348,8 +350,8 @@ FIN_BOX BOX wx:LayoutLine:Box52 ISEXEC:FALSE --75.572246:-93.852846:-900.000000 --42.252246:-96.352846:-900.000000 +-76.236744:-134.054998:-900.000000 +-42.916744:-136.554998:-900.000000 PORT Orientation:"V" PORT @@ -358,8 +360,8 @@ FIN_BOX BOX wx:LayoutLine:Box53 ISEXEC:FALSE --41.011552:-93.707878:-900.000000 --7.691552:-96.207878:-900.000000 +-41.676050:-133.910030:-900.000000 +-8.356050:-136.410030:-900.000000 PORT Orientation:"V" PORT @@ -368,20 +370,20 @@ FIN_BOX BOX wx:LayoutTab:Box54 ISEXEC:FALSE --62.599904:-100.523415:-900.000000 --29.279904:-103.023415:-900.000000 +-63.264402:-140.725567:-900.000000 +-29.944402:-143.225567:-900.000000 FIN_BOX BOX wx:OutputText:Box55 ISEXEC:FALSE --65.670256:-84.468011:-900.000000 --44.000256:-86.968011:-900.000000 +-60.022020:-120.350924:-900.000000 +-38.352020:-122.850924:-900.000000 FIN_BOX BOX wx:OutputText:Box56 ISEXEC:FALSE --23.051068:-86.101973:-900.000000 --1.381068:-88.601973:-900.000000 +-23.715566:-120.655889:-900.000000 +-2.045566:-123.155889:-900.000000 FIN_BOX BOX std:MagicBox:Box57 @@ -401,7 +403,19 @@ ISEXEC:FALSE -351.094473:125.944823:-900.000000 -329.494473:123.444823:-900.000000 FIN_BOX -CONNECTIONS:68 +BOX +std:ConcatStrings:Box60 +ISEXEC:FALSE +-257.304835:57.626119:-900.000000 +-234.544835:55.126119:-900.000000 +FIN_BOX +BOX +std:MultipleInputs:Box61 +ISEXEC:FALSE +-82.872928:-86.260830:-900.000000 +-60.902928:-88.760830:-900.000000 +FIN_BOX +CONNECTIONS:73 CONNECTION Box08:Widget:widget:widget NumberOfControlPoints:0 @@ -604,6 +618,21 @@ CONNECTION Box59:Out:Box72:Freeplane_transform NumberOfControlPoints:0 CONNECTION -Box37:boxchange:Box72:_execute +Box60:Box_ConcatStrings:Active_ConcatString:Active_ConcatString +NumberOfControlPoints:0 +CONNECTION +Box60:Out:Box72:active_widget +NumberOfControlPoints:0 +CONNECTION +Box60:Out:Box37:active +NumberOfControlPoints:0 +CONNECTION +Box37:boxchange:Box61:In2 +NumberOfControlPoints:0 +CONNECTION +Box61:BoxChange:Box72:_execute +NumberOfControlPoints:0 +CONNECTION +Box63:BoxChange:Box61:In1 NumberOfControlPoints:0 APP_END diff --git a/bbtk/bbs/boxes/Mesh_tool_ApplySmooth.bbs b/bbtk/bbs/boxes/Mesh_tool_ApplySmooth.bbs index c9bb716..27e0ecc 100644 --- a/bbtk/bbs/boxes/Mesh_tool_ApplySmooth.bbs +++ b/bbtk/bbs/boxes/Mesh_tool_ApplySmooth.bbs @@ -72,7 +72,6 @@ new std:MagicBox Box69 new std:MagicBox Box71 new creaMaracasVisu:MeshContours_Widget Box72 - set Box72.active_widget "1" set Box72.colorMesh "0 1 1" new wx:LayoutLine Box81 @@ -140,6 +139,10 @@ new std:MagicBox Box58 new std:MagicBox Box59 +new std:ConcatStrings Box60 + +new std:MultipleInputs Box61 + connect Box66.Out Box11.Renderer connect Box35.Out Box68.In @@ -195,7 +198,11 @@ connect Box56.Widget Box53.Widget9 connect Box57.BoxChange Box72.Freeplane_boxexecute connect Box58.Out Box72.Freeplane_point connect Box59.Out Box72.Freeplane_transform -connect Box37.boxchange Box72._execute +connect Box60.Out Box72.active_widget +connect Box60.Out Box37.active +connect Box37.boxchange Box61.In2 +connect Box61.BoxChange Box72._execute +connect Box63.BoxChange Box61.In1 # Complex input ports input mesh Box67.In " " @@ -213,6 +220,7 @@ input freeplane_transform Box59.In " " # Complex output ports output widget Box08.Widget " " +output Active_ConcatString Box60.Box_ConcatStrings " " endefine diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.cxx index 41cb959..ee247b6 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.cxx @@ -381,6 +381,7 @@ int ModelShowNPoints::IdInsidePoint() return id; } // if } + //------------------------------------------------------------------------ void ModelShowNPoints::SetPointById(int id, std::vector point) { @@ -393,6 +394,23 @@ void ModelShowNPoints::SetPointById(int id, std::vector point) printf("WidgetShowNPoints::SetPointById Invalid pointid, id is outside range\n"); } } + +std::vector ModelShowNPoints::GetPointById( int id ) +{ + std::vector point; + if(id >= 0 && id < lstPointsX.size()) + { + point.push_back ( lstPointsX[id] ); + point.push_back ( lstPointsY[id] ); + point.push_back ( lstPointsZ[id] ); + } + else{ + printf("WidgetShowNPoints::GetPointById Invalid pointid, id is outside range\n"); + } + return point; +} + + //------------------------------------------------------------------------ int ModelShowNPoints::RenamePoint(std::string label) { diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.h index 966d5ca..de99605 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.h @@ -34,6 +34,7 @@ class ModelShowNPoints int IdInsidePoint(); void SetPointById(int id, std::vector point); + std::vector GetPointById(int id); void SetReferencePoint(std::vector ppoint); std::vector GetReferencePoint(); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx index ee698ca..6ded365 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx @@ -694,25 +694,40 @@ void WidgetShowNPoints::OnInsertPoint (wxCommandEvent& event)//CFT //------------------------------------------------------------------------ void WidgetShowNPoints::OnAddPoint__() -{ +{ // EED 2022-05-19 //if (this->renderer==NULL) if (GetViewShowNPoints()->renderer==NULL) { return; } - std::vector point = GetModelShowNPoints()->GetReferencePoint(); - if (point.size()==3) + std::vector refPoint = GetModelShowNPoints()->GetReferencePoint(); + if (refPoint.size()==3) { - UndoRedo_SaveCollection(); //A - AddPoint(point[0],point[1],point[2], (const char*) ( textCtrl->GetValue().mb_str() ) ); - SetOutputBox(); - // EED 2022-05-19 - //renderer->GetRenderWindow()->Render(); - GetViewShowNPoints()->Render(); - UndoRedo_SaveCollection(); //B + std::vector lastPoint; + bool ok = true; + int lastId = GetModelShowNPoints()->GetLstPointsSize()-1; + if (lastId>=0) + { + lastPoint=GetModelShowNPoints()->GetPointById( lastId ); + if (lastPoint.size()==3) printf("WidgetShowNPoints::OnAddPoint__ lastPoint %f %f %f\n" , lastPoint[0],lastPoint[1],lastPoint[2] ); + if ((lastPoint[0]==refPoint[0]) && (lastPoint[1]==refPoint[1]) && (lastPoint[2]==refPoint[2])) + { + ok=false; + } // if lastPoint == refPoint + } // if lastId + if (ok==true) + { + UndoRedo_SaveCollection(); //A + AddPoint(refPoint[0],refPoint[1],refPoint[2], (const char*) ( textCtrl->GetValue().mb_str() ) ); + SetOutputBox(); + // EED 2022-05-19 + //renderer->GetRenderWindow()->Render(); + GetViewShowNPoints()->Render(); + UndoRedo_SaveCollection(); //B + } // if ok } else {//mpoint.size - printf("creaMaracasVisu::ShowNPoints (not match point) \n"); + printf("creaMaracasVisu::ShowNPoints OnAddPoint__ (not match point) \n"); } }