Set up cursor3D
(self)
| 62 | ''' |
| 63 | |
| 64 | def SetUp(self): |
| 65 | ''' |
| 66 | Set up cursor3D |
| 67 | ''' |
| 68 | |
| 69 | def OnClosing(): |
| 70 | self.root.quit() |
| 71 | |
| 72 | def AddSphere(ren): |
| 73 | objSource = vtkSphereSource() |
| 74 | |
| 75 | objMapper = vtkPolyDataMapper() |
| 76 | objMapper.SetInputConnection(objSource.GetOutputPort()) |
| 77 | |
| 78 | objActor = vtkActor() |
| 79 | objActor.SetMapper(objMapper) |
| 80 | objActor.GetProperty().SetRepresentationToWireframe() |
| 81 | |
| 82 | ren.AddActor(objActor) |
| 83 | |
| 84 | def AddOneTextActor(baseTextProp): |
| 85 | name = "ia" |
| 86 | self.textActors[name] = vtkTextActor3D() |
| 87 | # This adjustment is needed to reduce the difference |
| 88 | # between the Tcl and Python versions. |
| 89 | self.textActors[name].SetOrigin(0, -0.127878, 0) |
| 90 | |
| 91 | |
| 92 | tprop = self.textActors[name].GetTextProperty() |
| 93 | tprop.ShallowCopy(baseTextProp) |
| 94 | tprop.SetColor(1,0,0) |
| 95 | |
| 96 | # Add many text actors. |
| 97 | def AddManyTextActors(baseTextProp): |
| 98 | lut = vtkColorTransferFunction() |
| 99 | lut.SetColorSpaceToHSV() |
| 100 | lut.AddRGBPoint(0.0, 0.0, 1.0, 1.0) |
| 101 | lut.AddRGBPoint(1.0, 1.0, 1.0, 1.0) |
| 102 | |
| 103 | for i in range(0, 10): |
| 104 | name = "ia" + str(i) |
| 105 | |
| 106 | self.textActors[name] = vtkTextActor3D() |
| 107 | self.textActors[name].SetOrientation(0, i*36, 0) |
| 108 | #self.textActors[name].SetPosition(math.cos(i * 0.0314), 0, 0) |
| 109 | # This adjustment is needed to reduce the diffierence |
| 110 | # between the Tcl and Python versions. |
| 111 | self.textActors[name].SetOrigin(0, -0.127878, 0) |
| 112 | |
| 113 | tprop = self.textActors[name].GetTextProperty() |
| 114 | tprop.ShallowCopy(baseTextProp) |
| 115 | value = i / 10.0 |
| 116 | tprop.SetColor(lut.GetColor(value)) |
| 117 | |
| 118 | del lut |
| 119 | |
| 120 | # Update all text actors |
| 121 | def UpdateTextActors(event): |
no test coverage detected