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,propPickData,pointPickData,cellPickData)
| 207 | |
| 208 | |
| 209 | def pick(xy,propPickData,pointPickData,cellPickData): |
| 210 | """ |
| 211 | Position the camera such that a ray through the screen center |
| 212 | points in z direction at position xy, and pick with vtkPicker, |
| 213 | vtkPointPicker and vtkCellPicker. |
| 214 | Returns the number of errors |
| 215 | """ |
| 216 | size=rw.GetSize() |
| 217 | p=[size[0]/2,size[1]/2,0] |
| 218 | |
| 219 | cam=r.GetActiveCamera() |
| 220 | cam.SetPosition(xy[0],xy[1],-10.0) |
| 221 | cam.SetFocalPoint(xy[0],xy[1],0.0) |
| 222 | cam.SetViewUp(0,1,0) |
| 223 | cam.SetViewAngle(90) |
| 224 | cam.ParallelProjectionOff() |
| 225 | r.ResetCameraClippingRange() |
| 226 | rw.Render() |
| 227 | |
| 228 | errors = 0 |
| 229 | |
| 230 | if debug: |
| 231 | print('Picking at {}'.format(xy)) |
| 232 | errors += propPick(p,xy,propPickData) |
| 233 | errors += pointPick(p,xy,pointPickData) |
| 234 | errors += cellPick(p,xy,cellPickData) |
| 235 | |
| 236 | if debug: |
| 237 | time.sleep(3) |
| 238 | |
| 239 | return errors |
| 240 | |
| 241 | |
| 242 | # Run all of the tests defined by pickdata |
no test coverage detected