Beispiel #1
0
 def update_scrollBar(self):
     value = self.horizontalScrollBar.value()
     if (not self.isTraining):
         diff = value - self.hBarPreValue
         self.logFile.recordScroll("ExplosionBar", diff,
                                   self.camera.GetPosition(),
                                   self.camera.GetFocalPoint(),
                                   self.camera.GetDistance())
         self.hBarPreValue = value
     current_scroll = value / 50
     self.calExistingActorsIndex()
     coordinates = self.explodedViewDisplay(current_scroll,
                                            self.existingActorsIndex)
     if (self.lastDoubleClicked != None
             and self.lastDoubleClicked in self.existingActorsIndex):
         position = coordinates[self.existingActorsIndex.index(
             self.lastDoubleClicked)]
     for index in self.existingActorsIndex:
         if (self.lastDoubleClicked != None
                 and self.lastDoubleClicked in self.existingActorsIndex):
             self.modelActors[index].SetPosition(
                 self.keepTargetStill(
                     coordinates[self.existingActorsIndex.index(index)],
                     position))
         else:
             self.modelActors[index].SetPosition(
                 coordinates[self.existingActorsIndex.index(index)])
     if (self.textOn == True):
         self.neighborTextActor.SetPosition(
             interact.moveIndicateNumber(
                 self.indicateNumberOriginPos,
                 self.modelActors[self.lastSingleClicked].GetPosition()))
     self.vtkWidget.GetRenderWindow().Render()
 def formNeighborText(self, index, numberIndex):
     if (self.textOn == False):
         self.renderer.AddActor(self.neighborTextActor)
         self.textOn = True
     self.neighborTextActor.SetInput(str(self.assignedNumbers[numberIndex]))
     position = self.modelActors[index].GetCenter()
     pos1 = self.modelActors[self.showedNeighborListOwner].GetCenter()
     appendFilter = vtk.vtkAppendPolyData()
     appendFilter.AddInputData(self.modelActors[index].GetMapper().GetInput())
     appendFilter.Update()
     polyData = vtk.vtkPolyData()
     polyData = appendFilter.GetOutput()
     bounds = [0 for i in range(6)]
     polyData.GetBounds(bounds)
     indicateNumPos = interact.surfaceNearPoint(pos1, position, self.camera.GetPosition(), bounds)
     self.neighborTextActor.SetPosition(interact.moveIndicateNumber(indicateNumPos, self.modelActors[index].GetPosition()))
     self.renderer.AddActor2D(self.neighborTextActor)