本文整理汇总了Python中vtk.qt4.QVTKRenderWindowInteractor.QVTKRenderWindowInteractor.repaint方法的典型用法代码示例。如果您正苦于以下问题:Python QVTKRenderWindowInteractor.repaint方法的具体用法?Python QVTKRenderWindowInteractor.repaint怎么用?Python QVTKRenderWindowInteractor.repaint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vtk.qt4.QVTKRenderWindowInteractor.QVTKRenderWindowInteractor
的用法示例。
在下文中一共展示了QVTKRenderWindowInteractor.repaint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ExodusResultRenderWidget
# 需要导入模块: from vtk.qt4.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor [as 别名]
# 或者: from vtk.qt4.QVTKRenderWindowInteractor.QVTKRenderWindowInteractor import repaint [as 别名]
#.........这里部分代码省略.........
self.exodus_result.geom.Update()
self.current_bounds = self.exodus_result.actor.GetBounds()
self._updateContours()
else:
self.exodus_result.hideBlock(item.exodus_block)
self.exodus_result.reader.Update()
self.exodus_result.geom.Update()
self.current_bounds = self.exodus_result.actor.GetBounds()
self._updateContours()
def _displaceToggled(self, value):
self._timeSliderReleased()
def _scaleToggled(self, value):
self._timeSliderReleased()
def _displaceMagnitudeTextReturn(self):
self.current_displacement_magnitude = float(self.displace_magnitude_text.text())
self._timeSliderReleased()
def _scaleMagnitudeTextReturn(self):
self.current_scale_x_magnitude = float(self.scale_x_text.text())
self.current_scale_y_magnitude = float(self.scale_y_text.text())
self.current_scale_z_magnitude = float(self.scale_z_text.text())
self._timeSliderReleased()
def _drawEdgesChanged(self, value):
if value == QtCore.Qt.Checked:
self.exodus_result.actor.GetProperty().EdgeVisibilityOn()
self.exodus_result.clip_actor.GetProperty().EdgeVisibilityOn()
else:
self.exodus_result.actor.GetProperty().EdgeVisibilityOff()
self.exodus_result.clip_actor.GetProperty().EdgeVisibilityOff()
self.vtkwidget.repaint()
##
# A method for toggling visiability of the scale bar legend, it is controlled
# by the 'Hide Scalebar' toggle on the Visualize tab
# @param value The interger value from the checkbox (1=checked)
def _hideScalebarChanged(self, value):
# Show when checked
if value == QtCore.Qt.Checked:
self.exodus_result.scalar_bar.VisibilityOn()
# Hide when unchecked
else:
self.exodus_result.scalar_bar.VisibilityOff()
# Update the GUI
self.vtkwidget.repaint()
##
# A method for toggling black background or gradient background, it is controlled
# by the 'Black Background' toggle on the Visualize tab
# @param value The interger value from the checkbox (1=checked)
def _showBlackBackgroundChanged(self, value):
# Black when checked
if value == QtCore.Qt.Checked:
self.renderer.SetBackground(0,0,0)
self.renderer.SetGradientBackground(0)
#self.renderer.ResetCamera()
# Gradient when unchecked
else:
示例2: MeshRenderWidget
# 需要导入模块: from vtk.qt4.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor [as 别名]
# 或者: from vtk.qt4.QVTKRenderWindowInteractor.QVTKRenderWindowInteractor import repaint [as 别名]
#.........这里部分代码省略.........
name += ' : ' + self.mesh_renderer.sideset_id_to_name[int(name)]
sideset_names.append(name)
self.highlight_sideset_combo.addItem('')
for sideset_actor_name in sorted(sideset_names, key=lambda name: int(name.split(' ')[0])):
self.highlight_sideset_combo.addItem(sideset_actor_name)
nodeset_names = []
for nodeset_actor_id, nodeset_actor in self.current_nodeset_actors.items():
nodeset_actor.setColor(red)
name = nodeset_actor_id.strip(' ')
if int(name) in self.mesh_renderer.nodeset_id_to_name:
name += ' : ' + self.mesh_renderer.nodeset_id_to_name[int(name)]
nodeset_names.append(name)
self.highlight_nodeset_combo.addItem('')
for nodeset_actor_name in sorted(nodeset_names, key=lambda name: int(name.split(' ')[0])):
self.highlight_nodeset_combo.addItem(nodeset_actor_name)
self.highlight_block_combo.currentIndexChanged[str].connect(self.showBlockSelected)
self.highlight_sideset_combo.currentIndexChanged[str].connect(self.showSidesetSelected)
self.highlight_nodeset_combo.currentIndexChanged[str].connect(self.showNodesetSelected)
self.setBounds()
# Avoid z-buffer fighting
vtk.vtkPolyDataMapper().SetResolveCoincidentTopologyToPolygonOffset()
self.renderer.ResetCamera()
self.vtkwidget.repaint()
def setBounds(self):
for actor_name, actor in self.current_block_actors.items():
current_bounds = actor.getBounds()
self.bounds['x'][0] = min(self.bounds['x'][0], current_bounds[0])
self.bounds['x'][1] = max(self.bounds['x'][1], current_bounds[1])
self.bounds['y'][0] = min(self.bounds['y'][0], current_bounds[2])
self.bounds['y'][1] = max(self.bounds['y'][1], current_bounds[3])
self.bounds['z'][0] = min(self.bounds['z'][0], current_bounds[4])
self.bounds['z'][1] = max(self.bounds['z'][1], current_bounds[5])
def swapActors(self, current, new):
for old_name, old_actor in current.items():
new[old_name].sync(old_actor)
old_actor.hide()
def _blockViewItemChanged(self, item):
if item.checkState() == QtCore.Qt.Checked:
self.current_block_actors[str(item.exodus_block)].show()
else:
self.current_block_actors[str(item.exodus_block)].hide()
self.vtkwidget.repaint()
def _clippingToggled(self, value):
if value:
self.swapActors(self.current_block_actors, self.mesh_renderer.clipped_block_actors)
self.current_block_actors = self.mesh_renderer.clipped_block_actors
self.swapActors(self.current_sideset_actors, self.mesh_renderer.clipped_sideset_actors)
self.current_sideset_actors = self.mesh_renderer.clipped_sideset_actors
self.swapActors(self.current_nodeset_actors, self.mesh_renderer.clipped_nodeset_actors)