Position the camera such that a ray through the screen center points in z direction at position xy, and pick with vtkPicker, vtkPointPicker and vtkCellPicker. Returns the number of errors
(xy,cellPickData)
| 199 | |
| 200 | |
| 201 | def pick(xy,cellPickData): |
| 202 | """ |
| 203 | Position the camera such that a ray through the screen center |
| 204 | points in z direction at position xy, and pick with vtkPicker, |
| 205 | vtkPointPicker and vtkCellPicker. |
| 206 | Returns the number of errors |
| 207 | """ |
| 208 | size=rw.GetSize() |
| 209 | p=[size[0]/2,size[1]/2,0] |
| 210 | |
| 211 | cam=r.GetActiveCamera() |
| 212 | cam.SetPosition(xy[0],xy[1],2.0) |
| 213 | cam.SetFocalPoint(xy[0],xy[1],0.0) |
| 214 | cam.SetViewUp(0,1,0) |
| 215 | cam.SetViewAngle(35) |
| 216 | cam.ParallelProjectionOn() |
| 217 | r.ResetCameraClippingRange() |
| 218 | rw.Render() |
| 219 | |
| 220 | if debug: |
| 221 | print('Picking at {0}'.format(xy)) |
| 222 | |
| 223 | errors = cellPick(p,xy,cellPickData) |
| 224 | |
| 225 | if debug: |
| 226 | time.sleep(2) |
| 227 | |
| 228 | return errors |
| 229 | |
| 230 | |
| 231 | # Run all of the tests defined by pickdata |
no test coverage detected