def updateDisplayProperty(self, options): proxy = helper.idToProxy(options['proxy_id']); rep = simple.GetDisplayProperties(proxy) helper.updateProxyProperties(rep, options) # Try to bind the proper lookup table if need be if options.has_key('ColorArrayName') and len(options['ColorArrayName']) > 0: name = options['ColorArrayName'] type = options['ColorAttributeType'] nbComp = 1 if type == 'POINT_DATA': data = rep.GetRepresentedDataInformation().GetPointDataInformation() for i in range(data.GetNumberOfArrays()): array = data.GetArrayInformation(i) if array.GetName() == name: nbComp = array.GetNumberOfComponents() elif type == 'CELL_DATA': data = rep.GetRepresentedDataInformation().GetCellDataInformation() for i in range(data.GetNumberOfArrays()): array = data.GetArrayInformation(i) if array.GetName() == name: nbComp = array.GetNumberOfComponents() lut = self.lutManager.getLookupTable(name, nbComp) rep.LookupTable = lut simple.Render()
def updateDisplayProperty(self, options): proxy = helper.idToProxy(options['proxy_id']) rep = simple.GetDisplayProperties(proxy) helper.updateProxyProperties(rep, options) # Try to bind the proper lookup table if need be if options.has_key('ColorArrayName') and len( options['ColorArrayName']) > 0: name = options['ColorArrayName'] type = options['ColorAttributeType'] nbComp = 1 if type == 'POINT_DATA': data = rep.GetRepresentedDataInformation( ).GetPointDataInformation() for i in range(data.GetNumberOfArrays()): array = data.GetArrayInformation(i) if array.GetName() == name: nbComp = array.GetNumberOfComponents() elif type == 'CELL_DATA': data = rep.GetRepresentedDataInformation( ).GetCellDataInformation() for i in range(data.GetNumberOfArrays()): array = data.GetArrayInformation(i) if array.GetName() == name: nbComp = array.GetNumberOfComponents() lut = self.lutManager.getLookupTable(name, nbComp) rep.LookupTable = lut simple.Render()
def addSource(self, algo_name, parent): pid = str(parent) parentProxy = helper.idToProxy(parent) if parentProxy: simple.SetActiveSource(parentProxy) else: pid = '0' # Create new source/filter cmdLine = 'simple.' + algo_name + '()' newProxy = eval(cmdLine) # Create its representation and render simple.Show() simple.Render() simple.ResetCamera() # Add node to pipeline self.pipeline.addNode(pid, newProxy.GetGlobalIDAsString()) # Handle domains helper.apply_domains(parentProxy, newProxy.GetGlobalIDAsString()) # Create LUT if need be if pid == '0': self.lutManager.registerFieldData( newProxy.GetPointDataInformation()) self.lutManager.registerFieldData( newProxy.GetCellDataInformation()) # Return the newly created proxy pipeline node return helper.getProxyAsPipelineNode(newProxy.GetGlobalIDAsString(), self.lutManager)
def addSource(self, algo_name, parent): pid = str(parent) parentProxy = helper.idToProxy(parent) if parentProxy: simple.SetActiveSource(parentProxy) else: pid = '0' # Create new source/filter cmdLine = 'simple.' + algo_name + '()' newProxy = eval(cmdLine) # Create its representation and render simple.Show() simple.Render() simple.ResetCamera() # Add node to pipeline self.pipeline.addNode(pid, newProxy.GetGlobalIDAsString()) # Handle domains helper.apply_domains(parentProxy, newProxy.GetGlobalIDAsString()) # Create LUT if need be if pid == '0': self.lutManager.registerFieldData(newProxy.GetPointDataInformation()) self.lutManager.registerFieldData(newProxy.GetCellDataInformation()) # Return the newly created proxy pipeline node return helper.getProxyAsPipelineNode(newProxy.GetGlobalIDAsString(), self.lutManager)
def pushState(self, state): for proxy_id in state: if proxy_id == 'proxy': continue proxy = helper.idToProxy(proxy_id); helper.updateProxyProperties(proxy, state[proxy_id]) simple.Render() return helper.getProxyAsPipelineNode(state['proxy'], self.lutManager)
def reloadPipeline(self): self.pipeline.clear() pxm = simple.servermanager.ProxyManager() # Fill tree structure (order-less) for proxyInfo in pxm.GetProxiesInGroup("sources"): id = str(proxyInfo[1]) proxy = helper.idToProxy(id) parentId = helper.getParentProxyId(proxy) self.pipeline.addNode(parentId, id) return self.pipeline.getRootNode(self.lutManager)
def pushState(self, state): proxy_type = None for proxy_id in state: if proxy_id in ['proxy', 'widget_source']: proxy_type = proxy_id continue proxy = helper.idToProxy(proxy_id); helper.updateProxyProperties(proxy, state[proxy_id]) simple.Render() if proxy_type == 'proxy': return helper.getProxyAsPipelineNode(state['proxy'], self.lutManager) elif proxy_type == 'widget_source': proxy.UpdateWidget(proxy.Observed)
def pushState(self, state): proxy_type = None for proxy_id in state: if proxy_id in ['proxy', 'widget_source']: proxy_type = proxy_id continue proxy = helper.idToProxy(proxy_id) helper.updateProxyProperties(proxy, state[proxy_id]) simple.Render() if proxy_type == 'proxy': return helper.getProxyAsPipelineNode(state['proxy'], self.lutManager) elif proxy_type == 'widget_source': proxy.UpdateWidget(proxy.Observed)
def deleteSource(self, proxy_id): self.pipeline.removeNode(proxy_id) proxy = helper.idToProxy(proxy_id) simple.Delete(proxy) simple.Render()