void OnRadioButtonZ(wxEvent& event);
void OnRadioButtonN(wxEvent& event);
void OnSave(wxCommandEvent& event);
+ void Save(std::string filename);
void OnLoad(wxCommandEvent& event);
+ void Load(std::string filename);
void OnReset(wxCommandEvent& event);
void OnMoveDown(wxCommandEvent& event);
void OnMoveUp(wxCommandEvent& event);
mMemoryMatrix->DeepCopy( t->GetMatrix() );
}
+void TransformWidgetPanel::Save(std::string filename)
+{
+ FILE *ff;
+ ff = fopen( filename.c_str() , "w+" );
+ if (ff!=NULL)
+ {
+ fprintf(ff,"ActualPoint:\n");
+ fprintf(ff,"%f %f %f\n",mActualPoint[0], mActualPoint[1], mActualPoint[2] );
+ vtkMatrix4x4 *m = t->GetMatrix();
+ fprintf(ff,"Transform:\n");
+ fprintf(ff,"%f %f %f %f \n",m->GetElement(0,0), m->GetElement(1,0), m->GetElement(2,0), m->GetElement(3,0) );
+ fprintf(ff,"%f %f %f %f \n",m->GetElement(0,1), m->GetElement(1,1), m->GetElement(2,1), m->GetElement(3,1) );
+ fprintf(ff,"%f %f %f %f \n",m->GetElement(0,2), m->GetElement(1,2), m->GetElement(2,2), m->GetElement(3,2) );
+ fprintf(ff,"%f %f %f %f\n\n",m->GetElement(0,3), m->GetElement(1,3), m->GetElement(2,3), m->GetElement(3,3) );
+ fclose(ff);
+ } else { // else ff
+ printf("TransformWidgetPanel::OnSave ...Error... creating file \n");
+ } //ff
+}
+
void TransformWidgetPanel::OnSave(wxCommandEvent& event)
{
wxFileDialog* FD = new wxFileDialog( 0,
if (FD->GetReturnCode()==wxID_OK)
{
std::string filename= (const char*) ( FD->GetPath().mb_str() );
- FILE *ff;
- ff = fopen( filename.c_str() , "w+" );
- if (ff!=NULL)
- {
- fprintf(ff,"ActualPoint:\n");
- fprintf(ff,"%f %f %f\n",mActualPoint[0], mActualPoint[1], mActualPoint[2] );
- vtkMatrix4x4 *m = t->GetMatrix();
- fprintf(ff,"Transform:\n");
- fprintf(ff,"%f %f %f %f \n",m->GetElement(0,0), m->GetElement(1,0), m->GetElement(2,0), m->GetElement(3,0) );
- fprintf(ff,"%f %f %f %f \n",m->GetElement(0,1), m->GetElement(1,1), m->GetElement(2,1), m->GetElement(3,1) );
- fprintf(ff,"%f %f %f %f \n",m->GetElement(0,2), m->GetElement(1,2), m->GetElement(2,2), m->GetElement(3,2) );
- fprintf(ff,"%f %f %f %f\n\n",m->GetElement(0,3), m->GetElement(1,3), m->GetElement(2,3), m->GetElement(3,3) );
- fclose(ff);
- } else { // else ff
- printf("TransformWidgetPanel::OnSave ...Error... creating file \n");
- } //ff
+ Save( filename );
} // dialog box
}
+void TransformWidgetPanel::Load(std::string filename)
+{
+ FILE *ff;
+ ff = fopen( filename.c_str() , "r" );
+ if (ff!=NULL)
+ {
+ char tmpStr[128];
+ float t0,t1,t2,t3;
+ fscanf(ff,"%s\n",tmpStr); // ActualPoint:
+ fscanf(ff,"%f %f %f\n",&t0,&t1,&t2);
+ mActualPoint[0]=t0;
+ mActualPoint[1]=t1;
+ mActualPoint[2]=t2;
+
+ vtkMatrix4x4 *m = t->GetMatrix();
+ fscanf(ff,"%s\n",tmpStr); // Transform:
+ fscanf(ff,"%f %f %f %f\n",&t0,&t1,&t2,&t3);
+ m->SetElement(0,0,t0);
+ m->SetElement(1,0,t1);
+ m->SetElement(2,0,t2);
+ m->SetElement(3,0,t3);
+ fscanf(ff,"%f %f %f %f\n",&t0,&t1,&t2,&t3);
+ m->SetElement(0,1,t0);
+ m->SetElement(1,1,t1);
+ m->SetElement(2,1,t2);
+ m->SetElement(3,1,t3);
+ fscanf(ff,"%f %f %f %f\n",&t0,&t1,&t2,&t3);
+ m->SetElement(0,2,t0);
+ m->SetElement(1,2,t1);
+ m->SetElement(2,2,t2);
+ m->SetElement(3,2,t3);
+ fscanf(ff,"%f %f %f %f\n",&t0,&t1,&t2,&t3);
+ m->SetElement(0,3,t0);
+ m->SetElement(1,3,t1);
+ m->SetElement(2,3,t2);
+ m->SetElement(3,3,t3);
+ t->Update();
+
+ mBox->bbSetOutputActualPoint( mActualPoint );
+ mBox->bbSignalOutputModification(std::string("ActualPoint"));
+ mBox->bbSetOutputOut( t );
+ mBox->bbSignalOutputModification(std::string("Out"));
+
+ fclose(ff);
+ } else { // else ff
+ printf("TransformWidgetPanel::OnLoad ...Error... reading file \n");
+ } //ff
+}
+
void TransformWidgetPanel::OnLoad(wxCommandEvent& event)
{
wxFileDialog* FD = new wxFileDialog( 0,
- _T("Load groups of points .."),
+ _T("Load configuration.."),
_T(""),
_T(""),
_T("(*.fpConf)|*.fpConf"),
if (FD->GetReturnCode()==wxID_OK)
{
std::string filename= (const char*) ( FD->GetPath().mb_str() );
- FILE *ff;
- ff = fopen( filename.c_str() , "r" );
- if (ff!=NULL)
- {
- char tmpStr[128];
- float t0,t1,t2,t3;
- fscanf(ff,"%s\n",tmpStr); // ActualPoint:
- fscanf(ff,"%f %f %f\n",&t0,&t1,&t2);
- mActualPoint[0]=t0;
- mActualPoint[1]=t1;
- mActualPoint[2]=t2;
-
- vtkMatrix4x4 *m = t->GetMatrix();
- fscanf(ff,"%s\n",tmpStr); // Transform:
- fscanf(ff,"%f %f %f %f\n",&t0,&t1,&t2,&t3);
- m->SetElement(0,0,t0);
- m->SetElement(1,0,t1);
- m->SetElement(2,0,t2);
- m->SetElement(3,0,t3);
- fscanf(ff,"%f %f %f %f\n",&t0,&t1,&t2,&t3);
- m->SetElement(0,1,t0);
- m->SetElement(1,1,t1);
- m->SetElement(2,1,t2);
- m->SetElement(3,1,t3);
- fscanf(ff,"%f %f %f %f\n",&t0,&t1,&t2,&t3);
- m->SetElement(0,2,t0);
- m->SetElement(1,2,t1);
- m->SetElement(2,2,t2);
- m->SetElement(3,2,t3);
- fscanf(ff,"%f %f %f %f\n",&t0,&t1,&t2,&t3);
- m->SetElement(0,3,t0);
- m->SetElement(1,3,t1);
- m->SetElement(2,3,t2);
- m->SetElement(3,3,t3);
- t->Update();
-
- mBox->bbSetOutputActualPoint( mActualPoint );
- mBox->bbSignalOutputModification(std::string("ActualPoint"));
- mBox->bbSetOutputOut( t );
- mBox->bbSignalOutputModification(std::string("Out"));
-
- fclose(ff);
- } else { // else ff
- printf("TransformWidgetPanel::OnLoad ...Error... reading file \n");
- } //ff
+ Load( filename );
} // dialog box
-
}
//=====
// 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 TransformWidget2::Save(std::string filename)
+{
+ TransformWidgetPanel *w = (TransformWidgetPanel*) bbGetOutputWidget( );
+ w->Save(filename);
+}
+
+//------------------------------------------------------
+void TransformWidget2::Load(std::string filename)
+{
+ TransformWidgetPanel *w = (TransformWidgetPanel*) bbGetOutputWidget( );
+ w->Load(filename);
+}
+
+//------------------------------------------------------
void TransformWidget2::Process()
{
TransformWidgetPanel *w = (TransformWidgetPanel*) bbGetOutputWidget( );
{
firsttime=false;
w->_OnSetPoint();
+ bbSetOutputBox_TransformWidget2(this);
}// if
}
{
firsttime=true;
bbSetInputType(1);
+ bbSetOutputBox_TransformWidget2(NULL);
}
//=====
--- /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 "bbcreaMaracasVisuTransformWidget2_tool.h"
+#include "bbcreaMaracasVisuPackage.h"
+namespace bbcreaMaracasVisu
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,TransformWidget2_tool)
+BBTK_BLACK_BOX_IMPLEMENTATION(TransformWidget2_tool,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 TransformWidget2_tool::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 (bbGetInputType()==1)
+ {
+ if (bbGetInputParam01().size()==1)
+ {
+ bbGetInputBox_TransformWidget2()->Save( bbGetInputParam01()[0] );
+ }
+ } // Type 1 Save
+ if (bbGetInputType()==2)
+ {
+ if (bbGetInputParam01().size()==1)
+ {
+ bbGetInputBox_TransformWidget2()->Load( bbGetInputParam01()[0] );
+ }
+ } // Type 2 Load
+
+}
+//=====
+// 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 TransformWidget2_tool::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputType(0);
+
+}
+//=====
+// 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 TransformWidget2_tool::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 TransformWidget2_tool::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 __bbcreaMaracasVisuTransformWidget2_tool_h_INCLUDED__
+#define __bbcreaMaracasVisuTransformWidget2_tool_h_INCLUDED__
+
+#include "bbcreaMaracasVisu_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "bbcreaMaracasVisuTransformWidget2.h"
+
+
+namespace bbcreaMaracasVisu
+{
+
+class bbcreaMaracasVisu_EXPORT TransformWidget2_tool
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(TransformWidget2_tool,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(Type,int);
+ BBTK_DECLARE_INPUT(Param01,std::vector<std::string>);
+ BBTK_DECLARE_INPUT(Box_TransformWidget2,TransformWidget2*);
+// 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(TransformWidget2_tool,bbtk::AtomicBlackBox);
+ BBTK_NAME("TransformWidget2_tool");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+ BBTK_INPUT(TransformWidget2_tool,Type,"(default 0) 0:Nothing 1:Save file configuration 2:Load file configuration",int,"");
+ BBTK_INPUT(TransformWidget2_tool,Param01,"1:[FileName_save] 2:[FileName_load]",std::vector<std::string>,"");
+ BBTK_INPUT(TransformWidget2_tool,Box_TransformWidget2,"bbtk Box TransformWidget2",TransformWidget2*,"");
+// BBTK_OUTPUT(TransformWidget2_tool,Out,"First output",double,"");
+BBTK_END_DESCRIBE_BLACK_BOX(TransformWidget2_tool);
+//=====
+// 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 // __bbcreaMaracasVisuTransformWidget2_tool_h_INCLUDED__
+