def initializeGL(self): ''' Initialise the Zinc scene for drawing the axis glyph at a point. ''' # Following throws exception if you haven't called setContext() yet SceneviewerWidget.initializeGL(self) if self._sceneviewer and self._sceneviewer.isValid(): scene = self._sceneviewer.getScene() graphics_filter = self._sceneviewer.getScenefilter() self._scenepicker = scene.createScenepicker() region = scene.getRegion() fieldmodule = region.getFieldmodule() self._selectionGroup = fieldmodule.createFieldGroup() scene.setSelectionField(self._selectionGroup) self._scenepicker = scene.createScenepicker() self._scenepicker.setScenefilter(graphics_filter) sceneFilterModule = self.getContext().getScenefiltermodule() self._sceneSurfacesFilter = sceneFilterModule.createScenefilterOperatorAnd( ) surfacesFilter = sceneFilterModule.createScenefilterGraphicsType( Graphics.TYPE_SURFACES) self._sceneSurfacesFilter.appendOperand(graphics_filter) self._sceneSurfacesFilter.appendOperand(surfacesFilter) self.createSelectionBox(scene)
def initializeGL(self): ''' Initialise the Zinc scene for drawing the axis glyph at a point. ''' # Following throws exception if you haven't called setContext() yet SceneviewerWidget.initializeGL(self) if self._sceneviewer and self._sceneviewer.isValid(): scene = self._sceneviewer.getScene() graphics_filter = self._sceneviewer.getScenefilter() self._scenepicker = scene.createScenepicker() region = scene.getRegion() fieldmodule = region.getFieldmodule() self._selectionGroup = fieldmodule.createFieldGroup() scene.setSelectionField(self._selectionGroup) self._scenepicker = scene.createScenepicker() self._scenepicker.setScenefilter(graphics_filter) sceneFilterModule = self.getContext().getScenefiltermodule() self._sceneSurfacesFilter = sceneFilterModule.createScenefilterOperatorAnd() surfacesFilter = sceneFilterModule.createScenefilterGraphicsType(Graphics.TYPE_SURFACES) self._sceneSurfacesFilter.appendOperand(graphics_filter) self._sceneSurfacesFilter.appendOperand(surfacesFilter) self.createSelectionBox(scene)