8 // ----------------------------------------------------------------------------
9 // ----------------------------------------------------------------------------
10 // ----------------------------------------------------------------------------
13 _wxvtkbaseview = NULL;
16 // ----------------------------------------------------------------------------
22 // ----------------------------------------------------------------------------
23 void LineView::DeleteLines()
26 contour_mapped.clear();
27 contour_actor.clear();
30 // ----------------------------------------------------------------------------
31 void LineView::SetWxVtkBaseView(wxVtkBaseView *wxvtkbaseview)
33 _wxvtkbaseview = wxvtkbaseview;
36 // ----------------------------------------------------------------------------
37 void LineView::Refresh()
39 _wxvtkbaseview->GetRenWin()->Render();
42 // ----------------------------------------------------------------------------
43 void LineView::CreateNewLine(double x1, double y1, double z1, double x2, double y2, double z2)
46 vtkPoints* pointsLine = vtkPoints::New();
47 vtkPolyLine* aLine = vtkPolyLine::New();
48 vtkUnstructuredGrid* aLineGrid = vtkUnstructuredGrid::New();
49 contour_mapped.push_back(vtkDataSetMapper::New());
50 contour_actor.push_back(vtkActor::New());
52 pointsLine->SetNumberOfPoints(2);
53 pointsLine->InsertPoint(0,x1,y1,z1);
54 pointsLine->InsertPoint(1,x2,y2,z2);
56 (aLine->GetPointIds())->SetNumberOfIds(2);
57 (aLine->GetPointIds())->SetId(0,0);
58 (aLine->GetPointIds())->SetId(1,1);
60 aLineGrid->Allocate(1,1);
61 aLineGrid->InsertNextCell(aLine->GetCellType(),aLine->GetPointIds());
62 aLineGrid->SetPoints(pointsLine);
65 contour_mapped.back()->SetInput(aLineGrid);
66 contour_mapped.back()->ImmediateModeRenderingOn();
68 contour_actor.back()->SetMapper(contour_mapped.back());
69 contour_actor.back()->GetProperty()->BackfaceCullingOn();
70 contour_actor.back()->GetProperty()->SetDiffuseColor(0, 0, 1);
71 contour_actor.back()->ApplyProperties();
73 _wxvtkbaseview->GetRenderer()->AddActor(contour_actor.back());
74 _wxvtkbaseview->GetRenWin()->Render();
78 // ----------------------------------------------------------------------------
79 void LineView::DeleteVtkObjects()
81 int i,size=contour_mapped.size();
82 for (i=0;i<size; i++){
83 if ( contour_mapped[i] != NULL ) {
84 contour_mapped[i] -> Delete();
86 if ( contour_actor[i] != NULL ) {
87 _wxvtkbaseview->GetRenderer()->RemoveActor(contour_actor[i]);
88 contour_actor[i] -> Delete();
90 contour_actor[i] = NULL;
91 contour_mapped[i] = NULL;