//----------------------------------------------------------------------
- WidgetShowNPoints::WidgetShowNPoints(wxWindow *parent, vtkRenderer *renderer, ShowNPoints *box)
+ WidgetShowNPoints::WidgetShowNPoints(wxWindow *parent, bbcreaMaracasVisu::ShowNPoints *box)
: wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
{
mbbShowNPoints = box;
- this->renderer = renderer;
+ this->renderer = NULL;
wxPanel *panel = this;
wxSizer *sizer = NULL;
this->mimage=image;
}
-
-
//------------------------------------------------------------------------
-void WidgetShowNPoints::OnAddPoint (wxCommandEvent& event)
+void WidgetShowNPoints::SetRenderer(vtkRenderer *renderer)
{
-// printf("EED %p WidgetShowNPoints::OnAddPoint %d,%d,%d \n", this,mpoint[0],mpoint[1],mpoint[2] );
-
- if (mpoint.size()==3){
- lstPointsX.push_back( mpoint[0] );
- lstPointsY.push_back( mpoint[1] );
- lstPointsZ.push_back( mpoint[2] );
-
- // Sphere
- vtkSphereSource *vtksphere = vtkSphereSource::New();
- vtksphere->SetThetaResolution (20);
- vtksphere->SetPhiResolution (20);
- vtksphere->SetRadius( mradio );
- vtkPolyDataMapper *sphereMapper = vtkPolyDataMapper::New();
- sphereMapper->SetInput( vtksphere->GetOutput() );
- vtkActor *sphereActor = vtkActor::New();
- sphereActor->SetMapper(sphereMapper);
- sphereActor->SetOrigin(0, 0, 0);
- double spc[3];
- mimage->GetSpacing(spc);
- sphereActor->SetPosition( spc[0]*mpoint[0] , spc[1]*mpoint[1] , spc[2]*mpoint[2] );
- sphereActor->GetProperty()->SetColor( mcolour[0] , mcolour[1] , mcolour[2] );
- sphereActor->GetProperty()->SetOpacity( mopacity );
-
- lstActors.push_back(sphereActor);
- renderer->AddActor( sphereActor );
+ this->renderer = renderer;
+}
- renderer->GetRenderWindow()->Render();
- //--BBTK
- mbbShowNPoints->bbSignalOutputModification(std::string("Point"));
- }
+//------------------------------------------------------------------------
+void WidgetShowNPoints::OnAddPoint (wxCommandEvent& event)
+{
+printf("EED %p WidgetShowNPoints::OnAddPoint 01\n", this);
+ if (this->renderer!=NULL){
+printf("EED %p WidgetShowNPoints::OnAddPoint 02\n", this);
+ if (mpoint.size()==3){
+printf("EED %p WidgetShowNPoints::OnAddPoint 03\n", this);
+ lstPointsX.push_back( mpoint[0] );
+ lstPointsY.push_back( mpoint[1] );
+ lstPointsZ.push_back( mpoint[2] );
+
+ // Sphere
+ vtkSphereSource *vtksphere = vtkSphereSource::New();
+ vtksphere->SetThetaResolution (20);
+ vtksphere->SetPhiResolution (20);
+ vtksphere->SetRadius( mradio );
+ vtkPolyDataMapper *sphereMapper = vtkPolyDataMapper::New();
+ sphereMapper->SetInput( vtksphere->GetOutput() );
+ vtkActor *sphereActor = vtkActor::New();
+ sphereActor->SetMapper(sphereMapper);
+ sphereActor->SetOrigin(0, 0, 0);
+ double spc[3];
+ mimage->GetSpacing(spc);
+ sphereActor->SetPosition( spc[0]*mpoint[0] , spc[1]*mpoint[1] , spc[2]*mpoint[2] );
+ sphereActor->GetProperty()->SetColor( mcolour[0] , mcolour[1] , mcolour[2] );
+ sphereActor->GetProperty()->SetOpacity( mopacity );
+
+ lstActors.push_back(sphereActor);
+ renderer->AddActor( sphereActor );
+
+ renderer->GetRenderWindow()->Render();
+
+ //--BBTK
+//EED??? mbbShowNPoints->bbSignalOutputModification(std::string("Point"));
+
+ } else {//mpoint.size
+ printf("creaMaracasVisu::ShowNPoints (not match point)");
+ }
+ } // renderer
}
//------------------------------------------------------------------------
void WidgetShowNPoints::OnErasePoint(wxCommandEvent& event)
{
int id = lstActors.size()-1;
- if (id>=0){
- renderer->RemoveActor( lstActors[id] );
- lstActors.erase( lstActors.begin()+id );
- lstPointsX.erase( lstPointsX.begin()+id );
- lstPointsY.erase( lstPointsY.begin()+id );
- lstPointsZ.erase( lstPointsZ.begin()+id );
- renderer->GetRenderWindow()->Render();
- //--BBTK
- mbbShowNPoints->bbSignalOutputModification(std::string("Point"));
- }
-
+ if (this->renderer!=NULL){
+ if (id>=0){
+ renderer->RemoveActor( lstActors[id] );
+ lstActors.erase( lstActors.begin()+id );
+ lstPointsX.erase( lstPointsX.begin()+id );
+ lstPointsY.erase( lstPointsY.begin()+id );
+ lstPointsZ.erase( lstPointsZ.begin()+id );
+ renderer->GetRenderWindow()->Render();
+ //--BBTK
+//EED??? mbbShowNPoints->bbSignalOutputModification(std::string("Point"));
+ } // if id
+ } // if renderer
}
//------------------------------------------------------------------------
void WidgetShowNPoints::OnDeleteAllPoints(wxCommandEvent& event)
{
int i,size=lstActors.size();
- for (i=0;i<size;i++)
- {
- renderer->RemoveActor( lstActors[i] );
- }
- lstActors.clear();
- lstPointsX.clear();
- lstPointsY.clear();
- lstPointsZ.clear();
- renderer->GetRenderWindow()->Render();
- //--BBTK
- mbbShowNPoints->bbSignalOutputModification(std::string("Point"));
+ if (this->renderer!=NULL){
+ for (i=0;i<size;i++)
+ {
+ renderer->RemoveActor( lstActors[i] );
+ }
+ lstActors.clear();
+ lstPointsX.clear();
+ lstPointsY.clear();
+ lstPointsZ.clear();
+ renderer->GetRenderWindow()->Render();
+ //--BBTK
+//EED??? mbbShowNPoints->bbSignalOutputModification(std::string("Point"));
+ } // renderer
}
void ShowNPoints::Process()
{
+printf("EED %p ShowNPoints::Process 01\n", this);
if (mwxwidget!=NULL){
+printf("EED %p ShowNPoints::Process 02\n", this);
+ mwxwidget->SetRenderer( bbGetInputRenderer() );
mwxwidget->SetPoint( bbGetInputIn() );
mwxwidget->SetImage( bbGetInputImage() );
mwxwidget->SetColour( bbGetInputColour() );
void ShowNPoints::CreateWidget(wxWindow* parent)
{
- mwxwidget = new WidgetShowNPoints( parent , bbGetInputRenderer(), this);
+ mwxwidget = new WidgetShowNPoints( parent , this);
mwxwidget->SetPoint( bbGetInputIn() );
if (bbGetInputImage()==NULL)
}
bbSetOutputWidget( mwxwidget );
- Process();
}
void ShowNPoints::bbUserSetDefaultValues()
{
mwxwidget = NULL;
+
+ bbSetInputRadio(0.5);
+ bbSetInputOpacity(1);
+
std::vector<double> colour;
colour.push_back(1.0);
colour.push_back(0.0);
colour.push_back(0.0);
bbSetInputColour(colour);
- bbSetInputOpacity(1);
+
bbSetInputImage(NULL);
- bbSetInputRadio(0.5);
+ bbSetInputRenderer(NULL);
}
//-----------------------------------------------------------------