def setParams(self, params, negMsgHandler=None, sendToCover=True, realChange=None): """ set parameters from outside + init cutting surface module if necessary + mainly receive parameter changes from Gui + send status messages to COVER if state has changed """ _infoer.function = str(self.setParams) _infoer.write("") if realChange == None: realChange = ParamsDiff(self.params, params) if realChange == []: return if sendToCover and \ not 'showInteractor' in realChange and \ not 'showSmoke' in realChange and \ not 'isVisible' in realChange and \ not 'boundingBox' in realChange and \ not 'attachedClipPlane_index' in realChange and \ not 'attachedClipPlane_offset' in realChange and \ not 'attachedClipPlane_flip' in realChange: self.sendInteractor() if 'showInteractor' in realChange and sendToCover: self.sendInteractorStatus() if 'showSmoke' in realChange and sendToCover: self.sendSmokeStatus() if 'alignedRectangle' in realChange and sendToCover: self.sendInteractorAxis()
def emitDataChanged(self): if not len(self.__keys)==0 and not ObjectMgr().getTypeOfObject(self.__keys[0]) == TYPE_3D_COMPOSED_PART: params = self.__getParams() # mapping of the keys for the object manager childKeys = [] for i in range(0, len(self.__keys)): childKeys.append(Application.vrpApp.guiKey2visuKey[self.__keys[i]]) # set params for first object if len(self.__keys)>0 : #save original params originalParams = ObjectMgr().getParamsOfObject( childKeys[0] ) ObjectMgr().setParams( childKeys[0], params ) theGuiMsgHandler().runObject( childKeys[0] ) # set params for multi selection if len(self.__keys)>1 : #find changed params realChange = ParamsDiff( originalParams, params ) # set params for remaining selected objects for i in range(1, len(self.__keys)): childKeyParams = ObjectMgr().getParamsOfObject(childKeys[i]) # find the changed param in childKey and replace it with the # intended attribut for x in realChange : childKeyParams.__dict__[x] = params.__dict__[x] # set the params ObjectMgr().setParams( childKeys[i], childKeyParams ) theGuiMsgHandler().runObject( childKeys[i] )
def setParams(self, params, negMsgHandler=None, sendToCover=True): """ set parameters from outside """ _infoer.function = str(self.setParams) _infoer.write("setParams") if not params.isVisible == self.params.isVisible: if params.isVisible and not self.__connected: connect(self.connectionPoint(), globalRenderer().connectionPoint()) self.__connected = True elif not params.isVisible and self.__connected: disconnect(self.connectionPoint(), globalRenderer().connectionPoint()) self.__connected = False realChange = ParamsDiff(self.params, params) VisItem.setParams(self, params, negMsgHandler, sendToCover) if params.clickedSensorID != None: msg = coGRObjSensorEventMsg(coGRMsg.SENSOR_EVENT, params.filename, params.clickedSensorID, True, True) covise.sendRendMsg(msg.c_str()) msg = coGRObjSensorEventMsg(coGRMsg.SENSOR_EVENT, params.filename, params.clickedSensorID, True, False) covise.sendRendMsg(msg.c_str()) # clickedSensorButtonEvent was handled and can be removed self.params.clickedSensorID = None self.sendParams()
def setParams(self, params, negMsgHandler=None, sendToCover=True): """ set parameters from outside + init cutting surface module if necessary + mainly receive parameter changes from Gui + send status messages to COVER if state has changed """ _infoer.function = str(self.setParams) _infoer.write("setParams") realChange = ParamsDiff(self.params, params) PartModuleVis.setParams(self, params, negMsgHandler, sendToCover, realChange) PartColoredVis.setParams(self, params, negMsgHandler, sendToCover, realChange) PartInteractorVis.setParams(self, params, negMsgHandler, sendToCover, realChange) if 'isVisible' in realChange: if self.params.isVisible: self.sendClipPlane() else: self.sendClipPlaneOFF() if (('attachedClipPlane_index' in realChange) or ('attachedClipPlane_offset' in realChange) or ('attachedClipPlane_flip' in realChange)): self.sendClipPlane()
def emitDataChanged(self): _infoer.function = str(self.emitDataChanged) _infoer.write("") if len(self.__keys)>0 and not ObjectMgr().getTypeOfObject(self.__keys[0]) == TYPE_2D_COMPOSED_PART: ##all key types in self.keys should be the same # mapping of the keys for the object manager childKeys = [Application.vrpApp.guiKey2visuKey[k] for k in self.__keys] params = self.__getParams() if len(self.__keys)==1 : Application.vrpApp.key2params[childKeys[0]] = params ObjectMgr().setParams( childKeys[0], params ) #theGuiMsgHandler().runObject( childKey ) # set params for multi selection if len(self.__keys)>1 : #find changed params originalParams = self.oldPanelParams realChange = ParamsDiff( originalParams, params ) # set params for remaining selected objects for i in range(0, len(self.__keys)): childKeyParams = ObjectMgr().getParamsOfObject(childKeys[i]) # find the changed param in childKey and replace it with the # intended attribut for x in realChange : childKeyParams.__dict__[x] = params.__dict__[x] # set the params Application.vrpApp.key2params[childKeys[i]] = childKeyParams ObjectMgr().setParams( childKeys[i], childKeyParams ) #theGuiMsgHandler().runObject( childKeys[i] ) #save params for multi selection self.oldPanelParams = self.__getParams()
def emitCutChanged(self): _infoer.function = str(self.emitCutChanged) _infoer.write("") if len(self.__keys)>0 and ObjectMgr().getTypeOfObject(self.__keys[0]) == TYPE_2D_CUTGEOMETRY_PART: params = ObjectMgr().getRealParamsOfObject(self.__keys[0]) params.alignedRectangle = self.__rectangleManager.getParams() if len(self.__keys)==1 : Application.vrpApp.key2params[self.__keys[0]] = params ObjectMgr().setParams(self.__keys[0], params ) theGuiMsgHandler().runObject(self.__keys[0]) # set params for multi selection if len(self.__keys)>1 : #find changed params originalParams = self.oldPanelRealParams realChange = ParamsDiff( originalParams, params ) # set params for remaining selected objects for i in range(0, len(self.__keys)): childKeyParams = ObjectMgr().getRealParamsOfObject(self.__keys[i]) # find the changed param in childKey and replace it with the # intended attribut for x in realChange : childKeyParams.__dict__[x] = params.__dict__[x] # set the params Application.vrpApp.key2params[self.__keys[i]] = childKeyParams ObjectMgr().setParams( self.__keys[i], childKeyParams ) theGuiMsgHandler().runObject( self.__keys[i] ) #save params for multi selection self.oldPanelRealParams = CopyParams(params)
def emitDataChanged(self): _infoer.function = str(self.emitDataChanged) _infoer.write("") params = self.__getParams() if len(self.__keys) == 1: Application.vrpApp.key2params[self.__keys[0]] = params ObjectMgr().setParams(self.__keys[0], params) # set params for multi selection if len(self.__keys) > 1: #find changed params originalParams = self.oldPanelParams realChange = ParamsDiff(originalParams, params) # set params for remaining selected objects for i in range(0, len(self.__keys)): keyParams = ObjectMgr().getParamsOfObject(self.__keys[i]) # find the changed param in childKey and replace it with the # intended attribut for x in realChange: keyParams.__dict__[x] = params.__dict__[x] # set the params Application.vrpApp.key2params[self.__keys[i]] = keyParams ObjectMgr().setParams(self.__keys[i], keyParams) #theGuiMsgHandler().runObject( childKeys[i] ) #save params for multi selection self.oldPanelParams = self.__getParams()
def setParams(self, params, negMsgHandler=None, sendToCover=True): """ set parameters from outside """ _infoer.function = str(self.setParams) _infoer.write("setParams") realChange = ParamsDiff(self.params, params) VisItem.setParams(self, params, negMsgHandler, sendToCover) if 'filename' in realChange: self.parseCoxml() if sendToCover: if ('transX' in realChange) or \ ('transY' in realChange) or \ ('transZ' in realChange): self.sendObjMoved() if 'width' in realChange or 'height' in realChange or 'length' in realChange: self.sendGeometry() if 'variant_selected' in realChange: self.sendVariants() if 'appearance_colors' in realChange: self.sendAppearance() if 'kinematics_state' in realChange: self.sendKinematics() if len(self.params.children) > 0: self.sendChildren()
def setParams(self, params, negMsgHandler): _infoer.function = str(self.setParams) _infoer.write(" ") realChange = ParamsDiff(self.params, params) coKeydObject.setParams(self, params) if 'filename' in realChange: self.initPartTree(negMsgHandler)
def setParams(self, params, negMsgHandler=None, sendToCover=True): """ set parameters from outside + init module if necessary + mainly receive parameter changes from Gui + send status messages to COVER if state has changed """ realChange = ParamsDiff(self.params, params) PartModuleVis.setParams(self, params, negMsgHandler, sendToCover, realChange)
def setParams( self, params, negMsgHandler=None, sendToCover=True): """ set parameters from outside + init tracer module if necessary + mainly receive parameter changes from Gui + send status messages to COVER if state has changed """ _infoer.function = str(self.setParams) _infoer.write(" ") realChange = ParamsDiff( self.params, params ) PartModuleVis.setParams(self, params, negMsgHandler, sendToCover, realChange) PartTransform.setParams(self, params, negMsgHandler, sendToCover, realChange)
def setParams(self, params, negMsgHandler=None, sendToCover=True): coKeydObject.setParams(self, params) realChange = ParamsDiff(self.params, params) self.params.sync = params.sync self.params.reductionFactor = params.reductionFactor self.params.selectionString = params.selectionString self.params.filterChoice = params.filterChoice self.params.numTimeSteps = params.numTimeSteps self.params.cropMin = params.cropMin self.params.cropMax = params.cropMax self.params.animateOn = params.animateOn self.params.animationSpeed = params.animationSpeed self.params.actTimeStep = params.actTimeStep
def setParams(self, params, negMsgHandler=None, sendToCover=False): _infoer.function = str(self.setParams) _infoer.write( "old index: %d, new_index: %d, max_index:%d " % (self.params.currentIdx, params.currentIdx, self.params.maxIdx)) # change of maxIdx means shorten the history changedParams = ParamsDiff(self.params, params) if 'maxIdx' in changedParams: self.params.maxIdx = params.maxIdx for idx in range(self.__numSteps() - self.params.maxIdx - 1): del self.objects[0] self.params.currentIdx = self.params.maxIdx if negMsgHandler: negMsgHandler.sendParams(self.key, self.params) return if self.params.currentIdx == params.currentIdx: _infoer.write("currentIdx did not change") return old_index = self.params.currentIdx if params.currentIdx < -1 or params.currentIdx > self.params.maxIdx: _infoer.write("currentIdx out of range") return coKeydObject.setParams(self, params) #restore settings objsToRefresh = {} if self.params.currentIdx > old_index: inc = 1 else: inc = -1 for currentStepDiff in range(inc, self.params.currentIdx - old_index + inc, inc): pStepParams = self.objects[old_index + currentStepDiff].params obj = globalKeyHandler().getObject(pStepParams.key) #print "Setting params of object ", obj.name, pStepParams.key, pStepParams.param.__dict__ if pStepParams.action == STEP_PARAM: obj.setParams(CopyParams(pStepParams.param), negMsgHandler) objsToRefresh[obj] = True if negMsgHandler: negMsgHandler.sendParams(obj.key, obj.params) else: _infoer.write("param change not send to gui") #auto apply for obj in objsToRefresh: obj.run(RUN_ALL, negMsgHandler)
def setParams(self, params, negMsgHandler=None, sendToCover=True): realChange = ParamsDiff(self.params, params) VisItem.setParams(self, params, negMsgHandler, sendToCover) needsTransparency = False needsShader = False if 'isMoveable' in realChange: self.sendIsMoveable() if 'isMoveSelected' in realChange: self.sendIsMoveSelected() if 'transparency' in realChange or 'transparencyOn' in realChange: needsTransparency = True if hasattr(params, 'color' ) and 'color' in realChange and params.color == NO_COLOR: self.revertColor() needsTransparency = True if hasattr(params, 'color') and self.params.color == MATERIAL: if 'ambient' in realChange or 'r' in realChange or 'g' in realChange or 'b' in realChange or 'specular' in realChange or 'shininess' in realChange or 'transparency' in realChange or 'transparencyOn' in realChange or 'color' in realChange: self.sendMaterial() if hasattr(params, 'color') and params.color == RGB_COLOR: if 'r' in realChange or 'g' in realChange or 'b' in realChange or 'color' in realChange: self.sendColor() if ('shaderFilename' in realChange): needsTransparency = True needsShader = True # always send transparency before shader: # sendTransparency will ignore any shader transparency but sendShader respects the regular transparency if possible if needsTransparency and (params.shaderFilename != ""): needsShader = True if needsTransparency: self.sendTransparency() if needsShader: self.sendShader() # transformation matrix if 'rotAngle' in realChange or \ (self.params.rotAngle != 0 and ('rotX' in realChange or \ 'rotY' in realChange or \ 'rotZ' in realChange)) or \ ('transX' in realChange or 'transY' in realChange or 'transZ' in realChange) or \ ('scaleX' in realChange or 'scaleY' in realChange or 'scaleZ' in realChange): self.sendTransform()
def setParams( self, params, negMsgHandler): realChange = ParamsDiff( self.params, params ) coKeydObject.setParams( self, params) if self.group2d==None: self.params.name = self.params.filteredDsc.name negMsgHandler.sendParams( self.key, self.params ) self.initContent(negMsgHandler) # transformation matrix if 'rotAngle' in realChange or \ (self.params.rotAngle != 0 and ('rotX' in realChange or \ 'rotY' in realChange or \ 'rotZ' in realChange)) or \ ('transX' in realChange or 'transY' in realChange or 'transZ' in realChange) or \ ('scaleX' in realChange or 'scaleY' in realChange or 'scaleZ' in realChange): self._sendMatrix()
def setParams( self, params, negMsgHandler=None, sendToCover=True): return # TODO: probe is not working at the moment: stuck in saveExecute (data or grid missing) """ set parameters from outside + init tracer module if necessary + mainly receive parameter changes from Gui + send status messages to COVER if state has changed """ _infoer.function = str(self.setParams) _infoer.write("setParams") realChange = ParamsDiff( self.params, params ) PartModuleVis.setParams(self, params, negMsgHandler, sendToCover, realChange) PartColoredVis.setParams(self, params, negMsgHandler, sendToCover, realChange) PartInteractorVis.setParams(self, params, negMsgHandler, sendToCover, realChange)
def setParams(self, params, negMsgHandler=None, sendToCover=True): """ set parameters from outside + init module if necessary + mainly receive parameter changes from Gui + send status messages to COVER if state has changed """ realChange = ParamsDiff(self.params, params) PartModuleVis.setParams(self, params, negMsgHandler, sendToCover, realChange) PartColoredVis.setParams(self, params, negMsgHandler, sendToCover, realChange) PartTransform.setParams(self, params, negMsgHandler, sendToCover, realChange) if self.params.coloringOption == RGB_COLOR: self.__sendColor()
def setParams(self, params, negMsgHandler=None, sendToCover=True): """ set parameters from outside + init tracer module if necessary + mainly receive parameter changes from Gui + send status messages to COVER if state has changed """ _infoer.function = str(self.setParams) _infoer.write("setParams") realChange = ParamsDiff(self.params, params) PartModuleVis.setParams(self, params, negMsgHandler, sendToCover, realChange) PartColoredVis.setParams(self, params, negMsgHandler, sendToCover, realChange) PartInteractorVis.setParams(self, params, negMsgHandler, sendToCover, realChange) if 'use2DPartKey' in realChange: PartInteractorVis.sendInteractorPosibility(self)
def setParams(self, params, negMsgHandler=None, sendToCover=True, realChange=None): ''' set parameters from outside + init module if necessary + mainly receive parameter changes from Gui + send status messages to COVER if state has changed ''' _infoer.function = str(self.setParams) _infoer.write("setParams") if realChange == None: realChange = ParamsDiff(self.params, params) VisItem.setParams(self, params) # only connect to COVER if this visualizer really is visible and wasnt connected before if self._module: if self.params.isVisible and not self.__connectedToCOVER: VisItem.connectToCover(self, self) self.__connectedToCOVER = True
def setParams( self, params, negMsgHandler=None, sendToCover=True, realChange=None): ''' set parameters from outside''' if realChange==None: realChange = ParamsDiff( self.params, params ) #self.__needExecute = False if not hasattr(params, 'variable') or params.variable == 'Select a variable': return if 'variable' in realChange: self._initColor( negMsgHandler ) #self.__needExecute = True if 'secondVariable' in realChange: self._initColor( negMsgHandler ) # update base name of color table colorTable = globalKeyHandler().getObject(self.params.colorTableKey[self.currentVariable()]) colorTable.params.baseObjectName = self.params.name if negMsgHandler: negMsgHandler.sendParams( colorTable.key, colorTable.params, -1 )
def setParams(self, params, negMsgHandler=None, sendToCover=True): _infoer.function = str(self.setParams) _infoer.write(" ") self.sendImagePathToWebserver() realChange = ParamsDiff(self.params, params) # make sure, variable change is removed from params again if hasattr(self.params, 'changed'): oldChanged = self.params.changed else: oldChanged = False VisItem.setParams(self, params) self.params.changed = oldChanged #if 'imageName' in realChange and sendToCover: # self.sendImageName() # self.sendPosition() # self.sendVisibility() if 'pageNo' in realChange and sendToCover: self.sendPageNo() if 'size' in realChange and sendToCover: self.sendSize() if 'scaling' in realChange and sendToCover: self.sendScaling() if 'pos' in realChange and sendToCover: self.sendPosition() # changed in realChange happens when doc is changed in gui if 'changed' in realChange: # tell the coPresentationMgr that doc has changed globalKeyHandler().getObject( globalPresentationMgrKey).documentChanged( self.params.documentName, self.params.pos, self.params.isVisible, self.params.scaling, self.params.size, negMsgHandler)
def setParams(self, params, negMsgHandler=None, sendToCover=True): print("setParams ", self.params.name) realChange = ParamsDiff(self.params, params) VisItem.setParams(self, params, negMsgHandler, sendToCover) #if ('rotAngle' in realChange or (self.params.rotAngle > 0 and ('rotX' in realChange or 'rotY' in realChange or 'rotZ' in realChange)) or \ # ('transX' in realChange or 'transY' in realChange or 'transZ' in realChange)): self.sendTransformation() #send all connections for conn in self.params.connectionPoints: self.sendConnections(conn, [ self.params.connectionPoints[conn], self.params.connectionPointsDisable[conn] ]) # check if need connections is on and set variable nextPresStep self.params.nextPresStep = True if self.params.needConn: for cp in self.params.connectionPoints: if self.params.connectionPointsDisable[ cp] and not self.params.connectionPoints[cp]: self.params.nextPresStep = False
def setParams(self, params, negMsgHandler=None, sendToCover=True, realChange=None): """ set parameters from outside + init tracer module if necessary + mainly receive parameter changes from Gui + send status messages to COVER if state has changed """ _infoer.function = str(self.setParams) _infoer.write(" ") if not hasattr(self.params, 'rotAngle'): return if realChange == None: realChange = ParamsDiff(self.params, params) if ( 'rotAngle' in realChange \ or (self.params.rotAngle > 0 and ('rotX' in realChange or 'rotY' in realChange or 'rotZ' in realChange)) \ or ('transX' in realChange or 'transY' in realChange or 'transZ' in realChange) \ or ('scaleX' in realChange or 'scaleY' in realChange or 'scaleZ' in realChange) ): if not hasattr(self, '_sendToCOVER') or self._sendToCOVER: self._sendMatrix() self._setTransform()
def setParams(self, params, negMsgHandler=None, sendToCover=False): _infoer.function = str(self.setParams) _infoer.write(" ") # change of maxIdx means shorten the history oldParams = self.params changedParams = ParamsDiff(self.params, params) if hasattr(params, 'currentStep'): diffStep = params.currentStep - oldParams.currentStep else: diffStep = params.currentKey - oldParams.currentKey coKeydObject.setParams(self, params) if 'currentKey' in changedParams or 'reloadStep' in changedParams: if os.getenv('VR_PREPARE_DEBUG_VISITEMS_DIR'): for key in globalKeyHandler().getAllElements(): if globalKeyHandler().getObject(key) and isinstance( globalKeyHandler().getObject(key), VisItem): globalKeyHandler().getObject(key).updateDebugFilename( self.params.currentKey) # send message presentationstep changed if diffStep == 1: msg = coGRKeyWordMsg("presForward", True) covise.sendRendMsg(msg.c_str()) elif diffStep == -1: msg = coGRKeyWordMsg("presBackward", True) covise.sendRendMsg(msg.c_str()) elif 'reloadStep' in changedParams: msg = coGRKeyWordMsg("presReload", True) covise.sendRendMsg(msg.c_str()) else: msg_str = "goToStep " + str(params.currentStep) msg = coGRKeyWordMsg(msg_str, True) covise.sendRendMsg(msg.c_str()) if negMsgHandler: #if hasattr(globalKeyHandler().getObject(self.params.currentKey).params, 'status'): key2stateParam = globalKeyHandler().getObject( self.params.currentKey).params.status project = globalKeyHandler().getObject(0) keysInProject = [] keysInProject.append(globalProjectKey) self.__addToList(project, keysInProject) orderedKeysInProject1 = [] orderedKeysInProject2 = [] for key in keysInProject: # put some objects at the beginning of the list obj = globalKeyHandler().getObject(key) #check if visItem is readyToChange otherwise send message if diffStep > 0 and hasattr( obj.params, 'nextPresStep' ) and not obj.params.nextPresStep and covise.coConfigIsOn( "vr-prepare.SolvePresentationStep"): #roll back changes negMsgHandler.sendParams(globalPresentationMgrKey, oldParams) msg = coGRKeyWordMsg("showNotReady", True) covise.sendRendMsg(msg.c_str()) return if (obj.typeNr in [VIS_DOCUMENT, TYPE_TRACKING_MGR]): orderedKeysInProject1.append(key) else: orderedKeysInProject2.append(key) orderedKeysInProject1.extend(orderedKeysInProject2) for key in orderedKeysInProject1: if key in key2stateParam: params = key2stateParam[key] if not hasattr( params, 'flyingMode' ): # do not save settings of viewpointMgr obj = globalKeyHandler().getObject(key) newparams = CopyParams( obj.getParams() ) # take the objects params as base (so we have all the merged defaultParams) paramChanged = False for pkey in params.__dict__: if pkey in newparams.__dict__: if covise.coConfigIsOn("vr-prepare.DoNotUpdateCuttingSurfaces", False) \ and isinstance(obj, PartCuttingSurfaceVis. PartCuttingSurfaceVis) and pkey=='isVisible': pass elif hasattr( newparams, "isStaticParam" ) and newparams.isStaticParam(pkey): # skip static params pass elif pkey == 'actTimeStep' and ( not hasattr(params, 'version') or params.__dict__['version'] < 7): # change actual timestep for old 6.0 projects newparams.__dict__[ pkey] = params.__dict__[pkey] - 1 if newparams.__dict__[pkey] < 0: newparams.__dict__[ pkey] = newparams.__dict__[ 'numTimeSteps'] - 1 paramChanged = True elif (pkey == 'autoActiveSensorIDs') and (len( params.autoActiveSensorIDs) > 0): # always set params if the new step has autoActiveSensorIDs newparams.__dict__[ pkey] = copy.deepcopy( params.__dict__[pkey]) paramChanged = True else: if (newparams.__dict__[pkey] != params.__dict__[pkey]): newparams.__dict__[ pkey] = copy.deepcopy( params.__dict__[pkey] ) # need a deepcopy in case we have a list/dict paramChanged = True if (paramChanged): if key != globalProjectKey and 'currentKey' in changedParams: negMsgHandler.presentationRecvParams( key, newparams) negMsgHandler.sendParams(key, newparams) elif key != globalProjectKey: negMsgHandler.presentationRecvParams( key, newparams, True ) #TODO, ueberpruefen, ob das nach kompletter portierung noetig ist negMsgHandler.sendParams(key, newparams) else: negMsgHandler.sendParams(key, newparams) project.setParams(newparams) project.sendMessages() # hide all visItem which are not in list else: params = globalKeyHandler().getObject(key).params if params: #do not save settings of viewpointMgr if not hasattr(params, 'flyingMode'): if hasattr(params, 'isVisible') and params.isVisible: cparams = CopyParams(params) cparams.isVisible = False negMsgHandler.presentationRecvParams( key, cparams) negMsgHandler.sendParams(key, cparams)
def setParams( self, params, negMsgHandler=None, sendToCover=True): """ set parameters from outside + init tracer module if necessary + mainly receive parameter changes from Gui + send status messages to COVER if state has changed """ _infoer.function = str(self.setParams) _infoer.write(" ") # save the old variable to delete from colorTable oldVariable = self.currentVariable() oldTable = None if oldVariable!=None and oldVariable!= 'Select a variable': if hasattr(self.params.colorTableKey, oldVariable): oldTable = globalKeyHandler().getObject(self.params.colorTableKey[oldVariable]) realChange = ParamsDiff( self.params, params ) PartModuleVis.setParams(self, params, negMsgHandler, sendToCover, realChange) if self.params.color == VARIABLE: PartColoredVis.setParams(self, params, negMsgHandler, sendToCover, realChange) PartTransform.setParams(self, params, negMsgHandler, sendToCover, realChange) needsTransparency = False needsShader = False if hasattr (params, 'color') and (params.color == NO_COLOR) \ and ('color' in realChange): # disconnect colors module and run the collect module # (we dont want to call run since we dont need the children to be executed) if not self.__lastColorConnection==None: disconnect(self.__lastColorConnection, ConnectionPoint(self._module, 'DataIn0')) self.__lastColorConnection=None PartModuleVis.run(self, RUN_ALL, negMsgHandler) needsTransparency = True elif hasattr (params, 'color') and (params.color==RGB_COLOR) \ and (('color' in realChange) or ('r' in realChange) or ('g' in realChange) or ('b' in realChange)): self.__sendColor() needsTransparency = True elif hasattr (params, 'color') and (params.color==MATERIAL) \ and (('color' in realChange) or ('r' in realChange) or ('g' in realChange) or ('b' in realChange) \ or ('ambient' in realChange) or ('specular' in realChange) or ('shininess' in realChange)): self.__sendMaterial() needsTransparency = True elif hasattr(params, 'transparency') and ('transparency' in realChange): needsTransparency = True if 'variable' in realChange: # if variable changed append key to colorTable dependant keys # make sure this part is updated if colormap changes if params.variable!=None and params.variable!= 'Select a variable' and params.color == VARIABLE: # delete key from old colorTable if not oldTable == None and self.key in oldTable.params.dependantKeys: oldTable.params.dependantKeys.remove(self.key) # add key to new colorTable cTableObject = globalKeyHandler().getObject(params.colorTableKey[params.variable]) params.baseObjectName = params.name if self.key not in cTableObject.params.dependantKeys: cTableObject.params.dependantKeys.append(self.key) if negMsgHandler: negMsgHandler.internalRecvParams( cTableObject.key, cTableObject.params ) negMsgHandler.sendParams( cTableObject.key, cTableObject.params ) if ('shaderFilename' in realChange): needsTransparency = True needsShader = True # always send transparency before shader: # sendTransparency will ignore any shader transparency but sendShader respects the regular transparency if possible if needsTransparency and (params.shaderFilename != ""): needsShader = True if needsTransparency: self.__sendTransparency() if needsShader: self.__sendShader()
def setParams(self, params, negMsgHandler=None, sendToCover=True): _infoer.function = str(self.setParams) realChange = ParamsDiff(self.params, params) if 'newViewpoint' in realChange: _infoer.write("new viewpoint") newVp = negMsgHandler.internalRequestObject( TYPE_VIEWPOINT, self.key) newVp.params = coViewpointParams() newVp.params.id = params.newViewpoint[0] newVp.params.name = params.newViewpoint[1] newVp.params.view = params.newViewpoint[2] newVp.params.clipplane = params.newViewpoint[3] newVp.params.confirmed = True newVp.params.isVisible = True self.makeOthersInvisible(newVp, negMsgHandler) negMsgHandler.sendParams(newVp.key, newVp.params) elif 'newDefaultViewpoint' in realChange or ( not hasattr(self.params, 'newDefaultViewpoint') and (hasattr(params, 'newDefaultViewpoint') and not params.newDefaultViewpoint == None)): _infoer.write("new default viewpoint") newVp = negMsgHandler.internalRequestObject( TYPE_VIEWPOINT, self.key) newVp.params = coViewpointParams() newVp.params.id = params.newDefaultViewpoint[0] newVp.params.name = params.newDefaultViewpoint[1] newVp.params.view = "default" newVp.params.clipplane = "0" newVp.params.confirmed = True negMsgHandler.sendParams(newVp.key, newVp.params) elif 'changedViewpoint' in realChange: _infoer.write("change viewpoint") vpId = params.changedViewpoint[0] vpName = params.changedViewpoint[1] for obj in self.objects: if obj.params.id == vpId and obj.params.name == vpName: p = CopyParams(obj.params) p.view = params.changedViewpoint[2] p.changed = True if negMsgHandler: negMsgHandler.internalRecvParams(obj.key, p) negMsgHandler.sendParams(obj.key, p) break elif ('changeID' in realChange) or (hasattr(params, 'changeID') and params.changeID): _infoer.write("change id") for obj in self.objects: if obj.params.id == params.oldID and obj.params.confirmed == False: p = CopyParams(obj.params) p.id = params.newID p.confirmed = True if negMsgHandler: negMsgHandler.internalRecvParams(obj.key, p) negMsgHandler.sendParams(obj.key, p) self.params.changedID = False elif 'flyingMode' in realChange: _infoer.write("change flying Mode") self.params.flyingMode = params.flyingMode self.sendFlyingMode() #elif 'clipplaneMode' in realChange: # _infoer.write("change clipplane Mode") # self.params.clipplaneMode = params.clipplaneMode # self.sendClipplaneMode() self.params.clipplaneMode = True self.sendClipplaneMode() if 'selectedKey' in realChange: _infoer.write("selected new viewpoint") for obj in self.objects: if obj.params.id != params.selectedKey: p = CopyParams(obj.params) p.isVisible = False if negMsgHandler: negMsgHandler.internalRecvParams(obj.key, p) negMsgHandler.sendParams(obj.key, p) else: p = CopyParams(obj.params) p.isVisible = True self.params.currentKey = params.selectedKey if negMsgHandler: negMsgHandler.internalRecvParams(obj.key, p) negMsgHandler.sendParams(obj.key, p)
def setParams(self, params, negMsgHandler=None, sendToCover=True): _infoer.function = str(self.setParams) _infoer.write("%s" % params.isVisible) if params.id == None: return realChange = ParamsDiff(self.params, params) oldID = self.params.id if hasattr(self.params, 'confirmed'): oldConfirmed = self.params.confirmed else: oldConfirmed = True if hasattr(self.params, 'changed'): oldChanged = self.params.changed else: oldChanged = False VisItem.setParams(self, params, negMsgHandler, sendToCover) self.params.confirmed = oldConfirmed self.params.changed = oldChanged # confirmed and id in realChange happens when loading a project and having different default viewpoints if 'confirmed' in realChange and 'id' in realChange: self.params.confirmed = True if self.params.isVisible: self.show() # tell the coPresentationMgr that viewpoint is now confirmed and the id has changed globalKeyHandler().getObject( globalPresentationMgrKey).changeUnconfirmedViewpointID( oldID, params.id, negMsgHandler) else: if 'confirmed' in realChange: self.params.confirmed = True if self.params.isVisible: self.show() # tell the coPresentationMgr that viewpoint is confirmed globalKeyHandler().getObject( globalPresentationMgrKey).setViewpointConfirmed( params.id, negMsgHandler) if 'id' in realChange: # tell the presenterManager that my id has changed globalKeyHandler().getObject( globalPresentationMgrKey).changeViewPointID( oldID, params.id, negMsgHandler) if hasattr(self.params, 'delete'): self.delete(False, negMsgHandler) return if 'isVisible' in realChange and sendToCover and params.isVisible and hasattr( self.params, 'confirmed') and self.params.confirmed: _infoer.function = str(self.setParams) _infoer.write("send viewpoint") self.show() globalKeyHandler().getObject(self.parentKey).makeOthersInvisible( self, negMsgHandler) if 'name' in realChange and sendToCover: #send new name to cover msg = coGRChangeViewpointNameMsg(self.params.id, params.name) covise.sendRendMsg(msg.c_str()) # changed in realChange happens when viewpoint is changed in gui if 'changed' in realChange: # tell the coPresentationMgr that obj has changed globalKeyHandler().getObject( globalPresentationMgrKey).viewpointChanged( self.params.id, self.params.view, negMsgHandler)