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(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(textCtrl);
sizer1->Add(btnAddPoint);
sizer1->Add(btnRenamePoint);
sizer1->Add(btnEraseLastPoint);
sizer1->Add(btnDeleteAllPoints);
sizer1->Add(txtNrPoints);
+ sizer1->Add(txOpacity);
+ sizer1->Add(sdrOpacity);
+ sizer1->Add(txRadio);
+ sizer1->Add(sdrRadio);
sizer1->Add(btnSavePoints);
sizer1->Add(btnLoadPoints);
void WidgetShowNPoints::SetRadio(double radio)
{
- mradio=radio;
+ this->mradio=radio;
+ //NTU: For Slider
+ sdrRadio->SetValue(this->mradio);
}
//------------------------------------------------------------------------
void WidgetShowNPoints::SetOpacity(double opacity)
{
this->mopacity=opacity;
+ //NTU: For Slider
+ sdrOpacity->SetValue(this->mopacity*100.0);
}
//------------------------------------------------------------------------
vtksphere->SetThetaResolution (20);
vtksphere->SetPhiResolution (20);
vtksphere->SetRadius( mradio );
+
+ //NTU: For updating points
+
+ lstSourceSphere.push_back(vtksphere);
+
vtkPolyDataMapper *sphereMapper = vtkPolyDataMapper::New();
sphereMapper->SetInput( vtksphere->GetOutput() );
vtkActor *sphereActor = vtkActor::New();
renderer->RemoveActor( lstActorsText[id] );
lstActorsSphere[id]->Delete();
lstActorsText[id]->Delete();
+ lstSourceSphere[id]->Delete();
lstActorsSphere.erase( lstActorsSphere.begin()+id );
lstActorsText.erase( lstActorsText.begin()+id );
+ lstSourceSphere.erase( lstSourceSphere.begin()+id );
lstPointsX.erase( lstPointsX.begin()+id );
lstPointsY.erase( lstPointsY.begin()+id );
}
+//NTU: Method for updating points opacity and Radio
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::UpdatePoints(wxCommandEvent &event)
+{
+ //Difference in Radio for text placement
+ int difradio = sdrRadio->GetValue() - this->mradio;
+
+ this->mopacity = sdrOpacity->GetValue()/100.0;
+ this->mradio = sdrRadio->GetValue();
+
+ //NTU refresh the inputs
+ mbbShowNPoints->bbSetInputOpacity(this->mopacity);
+ mbbShowNPoints->bbSetInputRadio(this->mradio);
+
+ int size = (int) this->lstActorsSphere.size();
+ int i;
+ for(i = 0; i < size; i ++)
+ {
+ this->lstSourceSphere[i]->SetRadius(mradio);
+ this->lstActorsSphere[i]->GetProperty()->SetOpacity(mopacity);
+ this->lstActorsText[i]->SetPosition(this->lstActorsText[i]->GetPosition()[0]+difradio,this->lstActorsText[i]->GetPosition()[1], this->lstActorsText[i]->GetPosition()[2]);
+ }
+
+ //NTU: For updating
+ SetOutputBox();
+}
+
BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ShowNPoints)