BBTK_AUTHOR("InfoDev");
BBTK_DESCRIPTION("No Description.");
BBTK_CATEGORY("empty");
- BBTK_INPUT(ShowNPoints_Reset,WidgetShowNPoints," WidgetShowNPoints ",WidgetShowNPoints*,"");
+ BBTK_INPUT(ShowNPoints_Reset,WidgetShowNPoints,"WidgetShowNPoints",WidgetShowNPoints*,"");
//BBTK_OUTPUT(ShowNPoints_Reset,Out,"First output",double,"");
BBTK_END_DESCRIBE_BLACK_BOX(ShowNPoints_Reset);
//=====
--- /dev/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)
+//=====
+#include "bbcreaMaracasVisuShowNPoints_Tools.h"
+#include "bbcreaMaracasVisuPackage.h"
+namespace bbcreaMaracasVisu
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ShowNPoints_Tools)
+BBTK_BLACK_BOX_IMPLEMENTATION(ShowNPoints_Tools,bbtk::AtomicBlackBox);
+
+void ShowNPoints_Tools::CreatePatch01()
+{
+ bbGetInputWidgetShowNPoints()->CreatePatch01( );
+}
+
+//=====
+// 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 ShowNPoints_Tools::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 = " <<bbGetOutputOut() << std::endl;
+ if (bbGetInputWidgetShowNPoints()!=NULL)
+ {
+ if (bbGetInputType()==10)
+ {
+ bbGetInputWidgetShowNPoints()->OnInsertPoint_();
+ } // if Type
+ if (bbGetInputType()==20)
+ {
+ bbGetInputWidgetShowNPoints()->OnTrackPoint_tool();
+ } // if Type
+ if (bbGetInputType()==30)
+ {
+ bbGetInputWidgetShowNPoints()->OnSetPoint_();
+ } // if Type
+ if (bbGetInputType()==40)
+ {
+ bbGetInputWidgetShowNPoints()->OnErasePoint_();
+ } // if Type
+ if (bbGetInputType()==50)
+ {
+ bbGetInputWidgetShowNPoints()->DeleteAllPoints();
+ } // if Type
+ if (bbGetInputType()==100)
+ {
+ bbGetInputWidgetShowNPoints()->OnInsertCollectionAfter_();
+ } // if Type
+ if (bbGetInputType()==110)
+ {
+ bbGetInputWidgetShowNPoints()->OnDeleteCollection_();
+ } // if Type
+ if (bbGetInputType()==200)
+ {
+ CreatePatch01();
+ } // if Type
+ } // if bbGetInputWidgetShowNPoints
+}
+//=====
+// 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 ShowNPoints_Tools::bbUserSetDefaultValues()
+{
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputType(0);
+ bbSetInputMesh(NULL);
+ bbSetInputWidgetShowNPoints(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 ShowNPoints_Tools::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 ShowNPoints_Tools::bbUserFinalizeProcessing()
+{
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+}
+
+} // EO namespace bbcreaMaracasVisu
+
+
--- /dev/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)
+//=====
+#ifndef __bbcreaMaracasVisuShowNPoints_Tools_h_INCLUDED__
+#define __bbcreaMaracasVisuShowNPoints_Tools_h_INCLUDED__
+
+#include "bbcreaMaracasVisu_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "WidgetShowNPoints.h"
+#include "vtkPolyData.h"
+
+namespace bbcreaMaracasVisu
+{
+
+class bbcreaMaracasVisu_EXPORT ShowNPoints_Tools
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(ShowNPoints_Tools,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(WidgetShowNPoints,WidgetShowNPoints*);
+ BBTK_DECLARE_INPUT(Mesh,vtkPolyData*);
+ BBTK_DECLARE_INPUT(Type,int);
+// BBTK_DECLARE_OUTPUT(Out,double);
+ BBTK_PROCESS(Process);
+ void Process();
+
+ void CreatePatch01();
+//=====
+// 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(ShowNPoints_Tools,bbtk::AtomicBlackBox);
+BBTK_NAME("ShowNPoints_Tools");
+BBTK_AUTHOR("Info-Dev");
+BBTK_DESCRIPTION("No Description.");
+BBTK_CATEGORY("empty");
+ BBTK_INPUT(ShowNPoints_Tools,WidgetShowNPoints,"WidgetShowNPoints",WidgetShowNPoints*,"");
+ BBTK_INPUT(ShowNPoints_Tools,Mesh,"Mesh en format vtkPolyData ",vtkPolyData*,"");
+ BBTK_INPUT(ShowNPoints_Tools,Type,"(default 0) 0:Nothing 10:Insert Point 20:TrackPoint 30:Set nearest point 40:Erase point 50:Deleta all points 100:Insert group after 110:Delete group 200:Tool_1 - Create Mesh (based with one group and 4 points)",int,"");
+// BBTK_OUTPUT(ShowNPoints_Tools,Out,"First output",double,"");
+BBTK_END_DESCRIBE_BLACK_BOX(ShowNPoints_Tools);
+//=====
+// 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 // __bbcreaMaracasVisuShowNPoints_Tools_h_INCLUDED__
+
mwxwidget->GetModelShowNPoints()->SetFirstTime(false);
mwxwidget->SetInitLstPoints( bbGetInputInitLstPointsX() , bbGetInputInitLstPointsY() , bbGetInputInitLstPointsZ() , bbGetInputInitLstLabels() );
}
- mwxwidget->TrackPoint();
+ mwxwidget->TrackingPoint();
bbSetOutputlstPointsX( mwxwidget->GetLstPointsX() );
bbSetOutputlstPointsY( mwxwidget->GetLstPointsY() );
bbSetOutputlstPointsZ( mwxwidget->GetLstPointsZ() );
AddPoint(x,y,z,label);
}
GetViewShowNPoints()->RefreshPoints();
+}
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::OnInsertPoint_()
+{
+ // EED 2022-05-19
+ //if (this->renderer==NULL)
+ if (GetViewShowNPoints()->renderer==NULL)
+ {
+ return;
+ }
+ std::vector<int> point = GetModelShowNPoints()->GetReferencePoint();
+ if (point.size()==3)
+ {
+ InsertPoint(point[0],point[1],point[2], (const char*) ( textCtrl->GetValue().mb_str() ) );
+ SetOutputBox();
+ } else {//mpoint.size
+ printf("creaMaracasVisu::ShowNPoints (not match point) \n");
+ }
}
+
+
//------------------------------------------------------------------------
void WidgetShowNPoints::OnAddPoint (wxCommandEvent& event)
{
//------------------------------------------------------------------------
void WidgetShowNPoints::OnInsertPoint (wxCommandEvent& event)//CFT
-{
- // EED 2022-05-19
- //if (this->renderer==NULL)
- if (GetViewShowNPoints()->renderer==NULL)
- {
- return;
- }
-
- std::vector<int> point = GetModelShowNPoints()->GetReferencePoint();
- if (point.size()==3)
- {
- InsertPoint(point[0],point[1],point[2], (const char*) ( textCtrl->GetValue().mb_str() ) );
- SetOutputBox();
- } else {//mpoint.size
- printf("creaMaracasVisu::ShowNPoints (not match point) \n");
- }
+{
+ OnInsertPoint_();
}
} // dialog box
}
-
- //------------------------------------------------------------------------
- void WidgetShowNPoints::OnSetPoint(wxCommandEvent& event)
- {
- int id=GetModelShowNPoints()->GetNearestPoint();
- if((id==-1) && (mtype==1))
- {
- id=0;
- AddPoint(0,0,0,"");
- SetOutputBox();
- }
-
- if (id>=0)
- {
- GetModelShowNPoints()->SetPointId_mReferencePoint(id);
- // EED 2022-05-19
- //RefreshPoint(id);
- //renderer->GetRenderWindow()->Render();
- GetViewShowNPoints()->RefreshPoint(id);
- GetViewShowNPoints()->Render();
- } // if id
- SetOutputBox();
- }
-
//------------------------------------------------------------------------
-void WidgetShowNPoints::OnTrackPoint(wxCommandEvent& event)
+void WidgetShowNPoints::OnSetPoint_()
{
- idTrack = -1;
-// trackPointFlag = cbTrackPoint->GetValue();
- if ( cbTrackPoint->GetValue() == true )
+ int id=GetModelShowNPoints()->GetNearestPoint();
+ if((id==-1) && (mtype==1))
{
- idTrack = GetModelShowNPoints()->IdInsidePoint();
- } // if trackPointFlag
+ id=0;
+ AddPoint(0,0,0,"");
+ SetOutputBox();
+ }
+ if (id>=0)
+ {
+ GetModelShowNPoints()->SetPointId_mReferencePoint(id);
+ // EED 2022-05-19
+ //RefreshPoint(id);
+ //renderer->GetRenderWindow()->Render();
+ GetViewShowNPoints()->RefreshPoint(id);
+ GetViewShowNPoints()->Render();
+ } // if id
+ SetOutputBox();
}
//------------------------------------------------------------------------
-void WidgetShowNPoints::TrackPoint( )
+void WidgetShowNPoints::OnSetPoint(wxCommandEvent& event)
+{
+ OnSetPoint_();
+}
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::TrackingPoint( )
{
if ( cbTrackPoint->GetValue() == true )
{
} // if trackPointFlag
}
+//------------------------------------------------------------------------
+void WidgetShowNPoints::OnTrackPoint_tool()
+{
+ cbTrackPoint->SetValue( !cbTrackPoint->GetValue() );
+ OnTrackPoint_();
+}
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::OnTrackPoint_()
+{
+ idTrack = -1;
+ if ( cbTrackPoint->GetValue() == true )
+ {
+ idTrack = GetModelShowNPoints()->IdInsidePoint();
+ } // if trackPointFlag
+}
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::OnTrackPoint(wxCommandEvent& event)
+{
+ OnTrackPoint_();
+}
+
//------------------------------------------------------------------------
void WidgetShowNPoints::StopTrackPoint( )
{
idTrack=-1;
}
-
//------------------------------------------------------------------------
void WidgetShowNPoints::OnRenamePoint(wxCommandEvent& event)
{
}
//------------------------------------------------------------------------
- void WidgetShowNPoints::OnErasePoint(wxCommandEvent& event)
- {
- ErasePoint( GetModelShowNPoints()->IdInsidePoint() );
- SetOutputBox();
+ void WidgetShowNPoints::OnErasePoint_()
+ {
+ ErasePoint( GetModelShowNPoints()->IdInsidePoint() );
+ SetOutputBox();
// EED 2022-05-19
- //renderer->GetRenderWindow()->Render();
+ //renderer->GetRenderWindow()->Render();
GetViewShowNPoints()->Render();
StopTrackPoint();
+ }
+
+//------------------------------------------------------------------------
+ void WidgetShowNPoints::OnErasePoint(wxCommandEvent& event)
+ {
+ OnErasePoint_();
}
//------------------------------------------------------------------------
void WidgetShowNPoints::DeleteAllPoints()
{
// EED 2022-05-19
- //int id,size=lstActorsSphere.size();
+ //int id,size=lstActorsSphere.size();
int id,size=GetViewShowNPoints()->lstActorsSphere.size();
- for (id=size-1;id>=0;id--)
- {
- ErasePoint(id);
- }
- SetOutputBox();
+ for (id=size-1;id>=0;id--)
+ {
+ ErasePoint(id);
+ }
+ SetOutputBox();
// EED 2022-05-19
- //renderer->GetRenderWindow()->Render();
+ //renderer->GetRenderWindow()->Render();
GetViewShowNPoints()->Render();
}
+
//------------------------------------------------------------------------
void WidgetShowNPoints::OnDeleteAllPoints(wxCommandEvent& event)
{
}
//------------------------------------------------------------------------
-void WidgetShowNPoints::OnInsertCollectionAfter(wxCommandEvent &event)
+void WidgetShowNPoints::OnInsertCollectionAfter_()
{
mActualCollection++;
InsertCollection();
StopTrackPoint();
}
+//------------------------------------------------------------------------
+void WidgetShowNPoints::OnInsertCollectionAfter(wxCommandEvent &event)
+{
+ OnInsertCollectionAfter_();
+}
+
//------------------------------------------------------------------------
void WidgetShowNPoints::DeleteCollection_()
{
}
//------------------------------------------------------------------------
-void WidgetShowNPoints::OnDeleteCollection(wxCommandEvent &event)
+void WidgetShowNPoints::OnDeleteCollection_()
{
DeleteCollection_();
RefreshCollectionText();
StopTrackPoint();
}
+//------------------------------------------------------------------------
+void WidgetShowNPoints::OnDeleteCollection(wxCommandEvent &event)
+{
+ OnDeleteCollection_();
+}
+
//------------------------------------------------------------------------
void WidgetShowNPoints::OnBackCollection(wxCommandEvent &event)
{
return lstIndexs;
}
+
+void WidgetShowNPoints::CreatePatch01()
+{
+ if ( (lstModelShowNPoints.size()==1) && (GetModelShowNPoints()->GetLstPointsSize()==4) )
+ {
+ StopTrackPoint();
+ double px,py,pz;
+ double dx,dy,dz,s;
+ std::vector<int> lstX = GetModelShowNPoints()->GetLstPointsX();
+ std::vector<int> lstY = GetModelShowNPoints()->GetLstPointsY();
+ std::vector<int> lstZ = GetModelShowNPoints()->GetLstPointsZ();
+
+ // --- Group 0 ---
+ ErasePoint( 2 );
+ ErasePoint( 2 );
+ dx=lstX[1]-lstX[0];
+ dy=lstY[1]-lstY[0];
+ dz=lstZ[1]-lstZ[0];
+ s=0.33333;
+ px = lstX[0] + dx*s;
+ py = lstY[0] + dy*s;
+ pz = lstZ[0] + dz*s;
+ InsertPoint(px ,py, pz,"");
+ s=s*2;
+ px = lstX[0] + dx*s;
+ py = lstY[0] + dy*s;
+ pz = lstZ[0] + dz*s;
+ InsertPoint(px ,py, pz,"");
+
+ // --- Group 1 ---
+ OnInsertCollectionAfter_();
+ px = (lstX[0]+lstX[3])/2;
+ py = (lstY[0]+lstY[3])/2;
+ pz = (lstZ[0]+lstZ[3])/2;
+ InsertPoint(px ,py, pz,"");
+ px = (lstX[1]+lstX[2])/2;
+ py = (lstY[1]+lstY[2])/2;
+ pz = (lstZ[1]+lstZ[2])/2;
+ InsertPoint(px ,py, pz,"");
+ px = (lstX[0]+lstX[1]+lstX[2]+lstX[3])/4;
+ py = (lstY[0]+lstY[1]+lstY[2]+lstY[3])/4;
+ pz = (lstZ[0]+lstZ[1]+lstZ[2]+lstZ[3])/4;
+ InsertPoint(px ,py, pz,"");
+
+
+ // --- Group 2 ---
+ OnInsertCollectionAfter_();
+ px = lstX[3];
+ py = lstY[3];
+ pz = lstZ[3];
+ InsertPoint(px ,py, pz,"");
+ px = lstX[2];
+ py = lstY[2];
+ pz = lstZ[2];
+ InsertPoint(px ,py, pz,"");
+ dx=lstX[2]-lstX[3];
+ dy=lstY[2]-lstY[3];
+ dz=lstZ[2]-lstZ[3];
+ s=0.33333;
+ px = lstX[3] + dx*s;
+ py = lstY[3] + dy*s;
+ pz = lstZ[3] + dz*s;
+ InsertPoint(px ,py, pz,"");
+ s=s*2;
+ px = lstX[3] + dx*s;
+ py = lstY[3] + dy*s;
+ pz = lstZ[3] + dz*s;
+ InsertPoint(px ,py, pz,"");
+
+
+ SetOutputBox();
+ } else {
+ printf("EED WidgetShowNPoints::CreatePatch01 Warning patch not apply. Need juste one group with four points\n");
+ } // if
+}
~WidgetShowNPoints();
void OnAddPoint(wxCommandEvent &event);
void OnInsertPoint(wxCommandEvent& event);//CFT
+ void OnSetPoint_();
void OnSetPoint(wxCommandEvent& event);
void OnTrackPoint(wxCommandEvent& event);
- void TrackPoint();
+ void OnTrackPoint_();
+ void OnTrackPoint_tool();
+ void TrackingPoint();
void StopTrackPoint();
void DetectCollectionActive();
void OnRenamePoint(wxCommandEvent& event);
+ void OnErasePoint_();
void OnErasePoint(wxCommandEvent& event);
void OnEraseLastPoint(wxCommandEvent &event);
void OnDeleteAllPoints(wxCommandEvent &event);
void InsertCollection();
void OnInsertCollectionBefore(wxCommandEvent &event);
+ void OnInsertCollectionAfter_();
void OnInsertCollectionAfter(wxCommandEvent &event);
+ void OnDeleteCollection_();
void OnDeleteCollection(wxCommandEvent &event);
void DeleteCollection_();
void OnBackCollection(wxCommandEvent &event);
void SetReferencePoint(std::vector<int> point);
void AddPoint(int x, int y, int z, std::string label);
+ void OnInsertPoint_();
void InsertPoint(int x, int y, int z, std::string label);//CFT
void DeleteAllPoints();
double GetRadio();
double GetOpacity();
+ void CreatePatch01();
std::vector<int> GetLstPointsX();
std::vector<int> GetLstPointsY();