3 #include "ContourView.h"
6 // ----------------------------------------------------------------------------
7 // ----------------------------------------------------------------------------
8 // ----------------------------------------------------------------------------
10 ContourView::ContourView()
12 _wxvtkbaseview = NULL;
15 // ----------------------------------------------------------------------------
16 ContourView::~ContourView()
21 // ----------------------------------------------------------------------------
22 void ContourView::DeleteContours()
25 contour_mapped.clear();
26 contour_actor.clear();
29 // ----------------------------------------------------------------------------
30 void ContourView::SetWxVtkBaseView(wxVtkBaseView *wxvtkbaseview)
32 _wxvtkbaseview = wxvtkbaseview;
35 // ----------------------------------------------------------------------------
36 void ContourView::Refresh()
38 _wxvtkbaseview->GetRenWin()->Render();
41 // ----------------------------------------------------------------------------
42 void ContourView::CreateNewContour(vtkPolyData *contour, int type)
44 contour_mapped.push_back(vtkPolyDataMapper::New());
45 contour_mapped.back()->ImmediateModeRenderingOn();
46 contour_mapped.back()->ScalarVisibilityOff( );
47 contour_mapped.back()->SetInput(contour);
49 contour_actor.push_back(vtkActor::New());
50 contour_actor.back()->SetMapper(contour_mapped.back());
51 contour_actor.back()->GetProperty()->BackfaceCullingOff();
55 case ContourView::BLUE : contour_actor.back()->GetProperty()->SetDiffuseColor(0, 0, 1);
57 case ContourView::MAGENTA : contour_actor.back()->GetProperty()->SetDiffuseColor(1, 0, 1);
59 case ContourView::GREEN : contour_actor.back()->GetProperty()->SetDiffuseColor(0, 1, 0);
61 case ContourView::YELLOW : contour_actor.back()->GetProperty()->SetDiffuseColor(0, 1, 1);
63 default: contour_actor.back()->GetProperty()->SetDiffuseColor(0, 0, 1);
66 contour_actor.back()->GetProperty()->SetLineWidth(2);
67 contour_actor.back()->ApplyProperties();
69 _wxvtkbaseview->GetRenderer()->AddActor(contour_actor.back());
70 _wxvtkbaseview->GetRenWin()->Render();
73 // ----------------------------------------------------------------------------
74 void ContourView::DeleteVtkObjects()
76 int i,size=contour_mapped.size();
77 for (i=0;i<size; i++){
78 if ( contour_mapped[i] != NULL ) {
79 contour_mapped[i] -> Delete();
81 if ( contour_actor[i] != NULL ) {
82 _wxvtkbaseview->GetRenderer()->RemoveActor(contour_actor[i]);
83 contour_actor[i] -> Delete();
85 contour_actor[i] = NULL;
86 contour_mapped[i] = NULL;