MCPcopy Create free account
hub / github.com/Kitware/VTK / vtkLineWidget

Method vtkLineWidget

Interaction/Widgets/vtkLineWidget.cxx:101–195  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Begin the definition of the vtkLineWidget methods

Source from the content-addressed store, hash-verified

99// Begin the definition of the vtkLineWidget methods
100//
101vtkLineWidget::vtkLineWidget()
102{
103 this->State = vtkLineWidget::Start;
104 this->EventCallbackCommand->SetCallback(vtkLineWidget::ProcessEvents);
105
106 this->Align = vtkLineWidget::XAxis;
107
108 // Build the representation of the widget
109 int i;
110 // Represent the line
111 this->LineSource = vtkLineSource::New();
112 this->LineSource->SetResolution(5);
113 this->LineMapper = vtkPolyDataMapper::New();
114 this->LineMapper->SetInputConnection(this->LineSource->GetOutputPort());
115 this->LineActor = vtkActor::New();
116 this->LineActor->SetMapper(this->LineMapper);
117
118 // Create the handles
119 this->Handle = new vtkActor*[2];
120 this->HandleMapper = new vtkPolyDataMapper*[2];
121 this->HandleGeometry = new vtkSphereSource*[2];
122 for (i = 0; i < 2; i++)
123 {
124 this->HandleGeometry[i] = vtkSphereSource::New();
125 this->HandleGeometry[i]->SetThetaResolution(16);
126 this->HandleGeometry[i]->SetPhiResolution(8);
127 this->HandleMapper[i] = vtkPolyDataMapper::New();
128 this->HandleMapper[i]->SetInputConnection(this->HandleGeometry[i]->GetOutputPort());
129 this->Handle[i] = vtkActor::New();
130 this->Handle[i]->SetMapper(this->HandleMapper[i]);
131 }
132
133 // Define the point coordinates
134 double bounds[6];
135 bounds[0] = -0.5;
136 bounds[1] = 0.5;
137 bounds[2] = -0.5;
138 bounds[3] = 0.5;
139 bounds[4] = -0.5;
140 bounds[5] = 0.5;
141 this->PlaceFactor = 1.0; // overload parent's value
142
143 // Initial creation of the widget, serves to initialize it
144 this->PlaceWidget(bounds);
145 this->ClampToBounds = 0;
146
147 // Manage the picking stuff
148 this->HandlePicker = vtkCellPicker::New();
149 this->HandlePicker->SetTolerance(0.001);
150 for (i = 0; i < 2; i++)
151 {
152 this->HandlePicker->AddPickList(this->Handle[i]);
153 }
154 this->HandlePicker->PickFromListOn();
155
156 this->LinePicker = vtkCellPicker::New();
157 this->LinePicker->SetTolerance(0.005); // need some fluff
158 this->LinePicker->AddPickList(this->LineActor);

Callers 1

PythonSmoke.pyFile · 0.80

Calls 13

PlaceWidgetMethod · 0.95
SetThetaResolutionMethod · 0.80
SetPhiResolutionMethod · 0.80
NewFunction · 0.50
SetResolutionMethod · 0.45
SetInputConnectionMethod · 0.45
GetOutputPortMethod · 0.45
SetMapperMethod · 0.45
SetToleranceMethod · 0.45
AddPickListMethod · 0.45
AllOffMethod · 0.45

Tested by

no test coverage detected