wxPanel *panel = this;
wxSizer *sizer = NULL;
- // Widget interface
- askPointLabel = new wxStaticText(panel, -1, _T("Point label :")); // JPR
- textCtrl = new wxTextCtrl(panel, -1);
- wxButton *btnAddPoint = new wxButton( panel, -1, _T("Add Point"));
- wxButton *btnSetPositionPoint = new wxButton( panel, -1, _T("Set nearest point"));
- wxButton *btnRenamePoint = new wxButton( panel, -1, _T("Rename point"));
- wxButton *btnEraseLastPoint = new wxButton( panel, -1, _T("Erase Last point"));
- wxButton *btnErasePoint = new wxButton( panel, -1, _T("Erase point"));
- wxButton *btnDeleteAllPoints = new wxButton( panel, -1, _T("Delete all points"));
- wxButton *btnSavePoints = new wxButton( panel, -1, _T("Save points"));
- wxButton *btnLoadPoints = new wxButton( panel, -1, _T("Load points"));
- txtNrPoints = new wxStaticText(panel,-1, _T(" "));
-
- //NTU: Sliders for opacity and radio change
-
- wxStaticText* txOpacity = new wxStaticText(this, -1, wxString(_T(" Points Opacity ")));
- sdrOpacity = new wxSlider(this, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
-
- wxStaticText* txRadio = new wxStaticText(this, -1, wxString(_T(" Points Radio ")));
- sdrRadio = new wxSlider(this, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
-
- wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1);
-// sizer1->Add(new wxStaticText(panel,-1,_T(" ")));
-
- Connect(btnAddPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnAddPoint);
- 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);
- Connect(btnErasePoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnErasePoint);
- Connect(btnDeleteAllPoints->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnDeleteAllPoints);
- Connect(btnSavePoints->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnSavePoints);
- Connect(btnLoadPoints->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnLoadPoints);
-
- //NTU: Slider events
- Connect(sdrOpacity->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
- Connect(sdrRadio->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
-
- sizer1->Add(askPointLabel); // JPR
- sizer1->Add(textCtrl);
- sizer1->Add(btnAddPoint);
- sizer1->Add(btnSetPositionPoint);
- sizer1->Add(btnRenamePoint);
- sizer1->Add(btnErasePoint);
- sizer1->Add(btnEraseLastPoint);
- sizer1->Add(btnDeleteAllPoints);
- sizer1->Add(txtNrPoints);
- sizer1->Add(txOpacity);
- sizer1->Add(sdrOpacity,1,wxGROW );
- sizer1->Add(txRadio);
- sizer1->Add(sdrRadio,1,wxGROW );
- sizer1->Add(btnSavePoints);
- sizer1->Add(btnLoadPoints);
-
- sizer = sizer1;
- panel ->SetSizer(sizer);
- panel ->SetAutoLayout(true);
- panel ->Layout();
+ if (mbbShowNPoints->bbGetInputType()==0)
+ {
+ // Widget interface
+ askPointLabel = new wxStaticText(panel, -1, _T("Point label :")); // JPR
+ textCtrl = new wxTextCtrl(panel, -1);
+ wxButton *btnAddPoint = new wxButton( panel, -1, _T("Add Point"));
+ wxButton *btnSetPositionPoint = new wxButton( panel, -1, _T("Set nearest point"));
+ wxButton *btnRenamePoint = new wxButton( panel, -1, _T("Rename point"));
+ wxButton *btnEraseLastPoint = new wxButton( panel, -1, _T("Erase Last point"));
+ wxButton *btnErasePoint = new wxButton( panel, -1, _T("Erase point"));
+ wxButton *btnDeleteAllPoints = new wxButton( panel, -1, _T("Delete all points"));
+ wxButton *btnSavePoints = new wxButton( panel, -1, _T("Save points"));
+ wxButton *btnLoadPoints = new wxButton( panel, -1, _T("Load points"));
+ txtNrPoints = new wxStaticText(panel,-1, _T(" "));
+
+ //NTU: Sliders for opacity and radio change
+ wxStaticText* txOpacity = new wxStaticText(this, -1, wxString(_T(" Points Opacity ")));
+ sdrOpacity = new wxSlider(this, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
+ wxStaticText* txRadio = new wxStaticText(this, -1, wxString(_T(" Points Radio ")));
+ sdrRadio = new wxSlider(this, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
+
+ wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1);
+ // sizer1->Add(new wxStaticText(panel,-1,_T(" ")));
+
+ Connect(btnAddPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnAddPoint);
+ 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);
+ Connect(btnErasePoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnErasePoint);
+ Connect(btnDeleteAllPoints->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnDeleteAllPoints);
+ Connect(btnSavePoints->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnSavePoints);
+ Connect(btnLoadPoints->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnLoadPoints);
+
+ //NTU: Slider events
+ Connect(sdrOpacity->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
+ Connect(sdrRadio->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
+
+ sizer1->Add(askPointLabel); // JPR
+ sizer1->Add(textCtrl);
+ sizer1->Add(btnAddPoint);
+ sizer1->Add(btnSetPositionPoint);
+ sizer1->Add(btnRenamePoint);
+ sizer1->Add(btnErasePoint);
+ sizer1->Add(btnEraseLastPoint);
+ sizer1->Add(btnDeleteAllPoints);
+ sizer1->Add(txtNrPoints);
+ sizer1->Add(txOpacity);
+ sizer1->Add(sdrOpacity,1,wxGROW );
+ sizer1->Add(txRadio);
+ sizer1->Add(sdrRadio,1,wxGROW );
+ sizer1->Add(btnSavePoints);
+ sizer1->Add(btnLoadPoints);
+ sizer = sizer1;
+ }
+
+ if (mbbShowNPoints->bbGetInputType()==1)
+ {
+ // Widget interface
+ wxButton *btnSetPositionPoint = new wxButton( panel, -1, _T("Set nearest point"));
+ txtNrPoints = new wxStaticText(panel,-1, _T(" "));
+
+ //NTU: Sliders for opacity and radio change
+ wxStaticText* txOpacity = new wxStaticText(this, -1, wxString(_T(" Points Opacity ")));
+ sdrOpacity = new wxSlider(this, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
+ wxStaticText* txRadio = new wxStaticText(this, -1, wxString(_T(" Points Radio ")));
+ sdrRadio = new wxSlider(this, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
+ wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1);
+ 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);
+
+ sizer1->Add(btnSetPositionPoint);
+ sizer1->Add(txtNrPoints);
+ sizer1->Add(txOpacity);
+ sizer1->Add(sdrOpacity,1,wxGROW );
+ sizer1->Add(txRadio);
+ sizer1->Add(sdrRadio,1,wxGROW );
+ sizer = sizer1;
+ }
+
+ if (sizer!=NULL)
+ {
+ panel->SetSizer(sizer);
+ panel->SetAutoLayout(true);
+ panel->Layout();
+ }
}
//------------------------------------------------------------------------
lstActorsText.push_back(textActor);
RefreshPoint(lstPointsX.size()-1);
-
-
SetOutputBox();
}
void WidgetShowNPoints::OnSetPoint(wxCommandEvent& event)
{
int id=GetNearestPoint();
+ if((id==-1) && (mbbShowNPoints->bbGetInputType()==1))
+ {
+ id=0;
+ AddPoint(0,0,0,"");
+ }
+
+
if (id>=0)
{
printf("WidgetShowNPoints::OnSetPoint \n");
void ShowNPoints::CreateWidget(wxWindow* parent)
{
mwxwidget = new WidgetShowNPoints( parent, this);
- bbSetOutputWidget( mwxwidget );
+ bbSetOutputWidget( mwxwidget );
}
void ShowNPoints::bbUserSetDefaultValues()
{
- mwxwidget = NULL;
+ mwxwidget = NULL;
bbSetInputRadio(1);
bbSetInputOpacity(1);
bbSetInputColour(colour);
bbSetInputImage(NULL);
+ bbSetInputType(0);
bbSetInputRenderer(NULL);
}
std::vector<int> GetLstPointsZ();
std::vector<std::string> GetLstLabels();
+ void AddPoint(int x, int y, int z, std::string label);
+
private:
- void AddPoint(int x, int y, int z, std::string label);
std::string CleanSpaces(std::string ss);
int GetNearestPoint();
int IdInsidePoint();
BBTK_DECLARE_INPUT(Colour, std::vector<double> );
BBTK_DECLARE_INPUT(Opacity, double );
BBTK_DECLARE_INPUT(Radio, double );
+ BBTK_DECLARE_INPUT(Type, int );
BBTK_DECLARE_OUTPUT( lstPointsX, std::vector<int> );
BBTK_DECLARE_OUTPUT( lstPointsY, std::vector<int> );
BBTK_DECLARE_OUTPUT( lstPointsZ, std::vector<int> );
void CreateWidget(wxWindow*);
private:
- WidgetShowNPoints *mwxwidget;
-
+ WidgetShowNPoints *mwxwidget;
};
BBTK_BEGIN_DESCRIBE_BLACK_BOX(ShowNPoints,bbtk::WxBlackBox);
BBTK_INPUT(ShowNPoints,Colour,"Colour of the actor",std::vector<double>,"colour");
BBTK_INPUT(ShowNPoints,Opacity,"Opacity of the actor",double,"");
BBTK_INPUT(ShowNPoints,Radio,"Radio of the spheres",double,"");
+ BBTK_INPUT(ShowNPoints,Type,"Type of the widget. 0(default): N-points, 1:Just one point",int,"");
BBTK_OUTPUT(ShowNPoints , lstPointsX , " list of points X ", std::vector<int> ,"");
BBTK_OUTPUT(ShowNPoints , lstPointsY , " list of points Y ", std::vector<int> ,"");
BBTK_OUTPUT(ShowNPoints , lstPointsZ , " list of points Z ", std::vector<int> ,"");