def __getParams(self): data = coColorTableParams() data.name = str(self.vrpLineEditName.text()) data.species = self.__key2Species[self.__currentKey] data.min = getDoubleInLineEdit(self.vrpLineEditMin) data.max = getDoubleInLineEdit(self.vrpLineEditMax) data.steps = self.vrpSpinBoxSteps.value() data.colorMapIdx = self.vrpComboBoxMap.currentIndex() + 1 data.colorMapList = self.__colorMapList if self.radioButtonManual.isChecked(): data.mode = coColorTableParams.FREE elif self.radioButtonLocal.isChecked(): data.mode = coColorTableParams.LOCAL else: data.mode = coColorTableParams.GLOBAL data.baseObjectName = self.__baseObjectName data.baseMin = self.__baseMin data.baseMax = self.__baseMax data.globalMin = self.__globalMin data.globalMax = self.__globalMax data.dependantKeys = [] if self.__currentKey in self.__dependantKeys: for key in self.__dependantKeys[self.__currentKey]: if key not in data.dependantKeys: # ignore duplicates # check if the object still exists and uses this colormap params = ObjectMgr().getParamsOfObject(key) if params != None: if params.secondVariable != None: currentVariable = params.secondVariable else: currentVariable = params.variable if currentVariable in params.colorTableKey and params.colorTableKey[ currentVariable] == self.__currentKey: data.dependantKeys.append(key) return data
def __getParams(self): data = coColorTableParams() data.name = str(self.vrpLineEditName.text()) data.species = self.__key2Species[self.__currentKey] data.min = getDoubleInLineEdit(self.vrpLineEditMin) data.max = getDoubleInLineEdit(self.vrpLineEditMax) data.steps = self.vrpSpinBoxSteps.value() data.colorMapIdx = self.vrpComboBoxMap.currentIndex()+1 data.colorMapList = self.__colorMapList if self.radioButtonManual.isChecked(): data.mode = coColorTableParams.FREE elif self.radioButtonLocal.isChecked(): data.mode = coColorTableParams.LOCAL else: data.mode = coColorTableParams.GLOBAL data.baseObjectName = self.__baseObjectName data.baseMin = self.__baseMin data.baseMax = self.__baseMax data.globalMin = self.__globalMin data.globalMax = self.__globalMax data.dependantKeys = [] if self.__currentKey in self.__dependantKeys: for key in self.__dependantKeys[self.__currentKey]: if key not in data.dependantKeys: # ignore duplicates # check if the object still exists and uses this colormap params = ObjectMgr().getParamsOfObject(key) if params != None: if params.secondVariable!=None: currentVariable = params.secondVariable else: currentVariable = params.variable if currentVariable in params.colorTableKey and params.colorTableKey[currentVariable] == self.__currentKey: data.dependantKeys.append( key ) return data
def _initColor(self, negMsgHandler): ''' + start a ColorCreator if it does not exist + set current color table according to the currently used variable + if no color table for that variable exists : create one and set min/max accoring current variable + set colorTable param in the ColorCreator + set dependantKey in the color table ''' #assert negMsgHandler if self.importModule==None or self.currentVariable()==None: return if not self.currentVariable() in self.params.colorTableKey: colorTableKey = (globalKeyHandler().getObject(KeydObject.globalColorMgrKey)).getKeyOfTable( self.currentVariable() ) if not colorTableKey==None: _infoer.function = str(self._initColor) _infoer.write("using existing table for %s" % self.currentVariable()) self.params.colorTableKey[self.currentVariable()] = colorTableKey colorTable = globalKeyHandler().getObject(colorTableKey) elif negMsgHandler : _infoer.function = str(self._initColor) _infoer.write("creating color table for %s" % self.currentVariable()) colorTable = negMsgHandler.internalRequestObject( TYPE_COLOR_TABLE ) if colorTable==None: # request was called during recreation return self.params.colorTableKey[self.currentVariable()] = colorTable.key tP = coColorTableParams() dataRange = self.importModule.getDataMinMax(self.currentVariable()) if dataRange: tP.globalMin = float(dataRange[0]) tP.globalMax = float(dataRange[1]) tP.min = float(dataRange[0]) tP.max = float(dataRange[1]) tP.species = self.currentVariable() tP.name = (globalKeyHandler().getObject(KeydObject.globalColorMgrKey)).getRightName(tP.species) if not self.__colorMap: tP.baseObjectName = "Part" colorTable.setParams(tP) negMsgHandler.sendParams(colorTable.key, tP) # send the now known colorTableKey back to the GUI if negMsgHandler: negMsgHandler.sendParams( self.key, self.params ) # create or update colorCreator _infoer.function = str(self._initColor) _infoer.write("updating color creator for %s" % self.currentVariable()) cP = coColorCreatorParams() cP.colorTableKey = self.params.colorTableKey[self.currentVariable()] if not self.__colorMap: cP.variable = self.currentVariable() cP.importModule = self.importModule if len(self.objects)>0: (self.objects[0]).setParams(cP) #(self.objects[0]).run(RUN_ALL) # This is nescessary because CuttingSurfaceComp can't be executed without a colormap if sampled data is present. Because of PartColoredVis called after PartModuleVis, the colors module is not executed before. #print("PartColoredVis._initColor(): omitting explicit (self.objects[0]).run(RUN_ALL)") else: if negMsgHandler: _infoer.function = str(self._initColor) _infoer.write("creating color creator for %s" % self.currentVariable()) colorCreator=negMsgHandler.internalRequestObject( TYPE_COLOR_CREATOR, self.key) colorCreator.setParams(cP) colorCreator.run(RUN_ALL) # Make sure the objects key is contained in the colormaps dependantKeys colorTable = globalKeyHandler().getObject(self.params.colorTableKey[self.currentVariable()]) if self.key not in colorTable.params.dependantKeys: colorTable.params.dependantKeys.append(self.key) if negMsgHandler: negMsgHandler.sendParams( colorTable.key, colorTable.params )