Beispiel #1
0
 def delete(self, isInitialized, negMsgHandler=None):
     ''' delete this CoviseVis: remove the module '''
     _infoer.function = str(self.delete)
     _infoer.write(" ")
     if isInitialized:
         theNet().remove(self.coverDocument)
     VisItem.delete(self, isInitialized, negMsgHandler)
Beispiel #2
0
 def delete(self, isInitialized, negMsgHandler=None):
     ''' delete this CoviseVis: remove the module '''
     _infoer.function = str(self.delete)
     _infoer.write(" ")
     if isInitialized:
         theNet().remove(self.coverDocument)
     VisItem.delete(self, isInitialized, negMsgHandler)
Beispiel #3
0
 def recreate(self, negMsgHandler, parentKey, offset):
     VrmlVisParams.mergeDefaultParams(
         self.params)  # explicitly call mergeDefaultParams of this class
     self.__initBase()
     VisItem.recreate(self, negMsgHandler, parentKey, offset)
     if getExistingFilename(self.params.filename) == None:
         raise CoviseFileNotFoundError(self.params.filename)
Beispiel #4
0
    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()
Beispiel #5
0
 def delete(self, isInitialized, negMsgHandler=None):
     ''' delete this VisItem: remove the module '''
     _infoer.function = str(self.delete)
     _infoer.write(" ")
     if isInitialized:
         if hasattr(self, '_module') and self._module: theNet().remove(self._module)
     VisItem.delete(self, isInitialized, negMsgHandler)
Beispiel #6
0
    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)
Beispiel #7
0
    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()
Beispiel #8
0
    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()
Beispiel #9
0
    def delete(self, isInitialized, negMsgHandler=None):
        ''' delete this CoviseVis: remove the module '''
        _infoer.function = str(self.delete)
        _infoer.write(" ")

        if isInitialized:

            # Manually remove the object from any parent object it is mounted to.
            # This is not very elegant because when an object (child) is deleted, the unmounting
            # done in OpenCOVER will send a removeChildMessage to the parent. However, because
            # it's a separate process, the child will already be fully deleted in vr-prepare
            # when receiving this message and the coverKey of the child is not known anymore.   
            sceneObjects = [obj for obj in globalKeyHandler().getAllElements().itervalues() if hasattr(obj,"typeNr") and (obj.typeNr == VIS_SCENE_OBJECT)]
            for obj in sceneObjects:
                if self.key in obj.params.children:
                    params = CopyParams(obj.params)
                    params.children.remove(self.key)
                    negMsgHandler.internalRecvParams( obj.key, params )
                    negMsgHandler.sendParams( obj.key, params )


            self.sendDelete()

            theNet().remove(self.performerScene)

        VisItem.delete(self, isInitialized, negMsgHandler)
Beispiel #10
0
 def recreate(self, negMsgHandler, parentKey, offset):
     coDNAItemParams.mergeDefaultParams(self.params) # explicitly call mergeDefaultParams of this class
     PartTransform.recreate(self, negMsgHandler, parentKey, offset)   
     VisItem.recreate(self, negMsgHandler, parentKey, offset)
     for conn in self.params.connectionPoints:
         self.sendConnections(conn, [self.params.connectionPoints[conn],self.params.connectionPointsDisable[conn]])
     self.sendTransformation()
Beispiel #11
0
    def run(self, runmode, negMsgHandler=None):
        if runmode == RUN_ALL:
            _infoer.function = str(self.run)
            _infoer.write("go")
            self.__update()
            if not self.__connected and self.params.isVisible:
                VisItem.connectToCover(self, self)
                self.__connected = True
            if not self.__loaded:
                saveExecute(self.performerScene)
                self.__loaded = True

        # dont auto-activate sensors in recreation
        if negMsgHandler and negMsgHandler.getInRecreation() == False:
            # bei run() die sensoren starten
            # wird (ausserhalb von recreate) nur vom presentation manager aufgerufen
            for sensorID in self.params.autoActiveSensorIDs:
                msg = coGRObjSensorEventMsg(coGRMsg.SENSOR_EVENT,
                                            self.params.filename, sensorID,
                                            True, True)
                covise.sendRendMsg(msg.c_str())
                msg = coGRObjSensorEventMsg(coGRMsg.SENSOR_EVENT,
                                            self.params.filename, sensorID,
                                            True, False)
                covise.sendRendMsg(msg.c_str())
Beispiel #12
0
    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()
Beispiel #13
0
 def __init__(self):
     VisItem.__init__(self, VIS_2D_SCALAR_COLOR, self.__class__.__name__)
     self.params = Part2DScalarColorVisParams()
     self.__colors = None
     self.__collect = None
     # currently used input connection to colors module
     self.__lastDataConnection = None
Beispiel #14
0
 def __init__(self):
     VisItem.__init__(self, VIS_2D_SCALAR_COLOR, self.__class__.__name__)
     self.params = Part2DScalarColorVisParams()
     self.__colors = None
     self.__collect = None
     # currently used input connection to colors module
     self.__lastDataConnection = None
Beispiel #15
0
    def delete(self, isInitialized, negMsgHandler=None):
        ''' delete this CoviseVis: remove the module '''
        _infoer.function = str(self.delete)
        _infoer.write(" ")

        if isInitialized:

            # Manually remove the object from any parent object it is mounted to.
            # This is not very elegant because when an object (child) is deleted, the unmounting
            # done in OpenCOVER will send a removeChildMessage to the parent. However, because
            # it's a separate process, the child will already be fully deleted in vr-prepare
            # when receiving this message and the coverKey of the child is not known anymore.
            sceneObjects = [
                obj
                for obj in globalKeyHandler().getAllElements().itervalues()
                if hasattr(obj, "typeNr") and (obj.typeNr == VIS_SCENE_OBJECT)
            ]
            for obj in sceneObjects:
                if self.key in obj.params.children:
                    params = CopyParams(obj.params)
                    params.children.remove(self.key)
                    negMsgHandler.internalRecvParams(obj.key, params)
                    negMsgHandler.sendParams(obj.key, params)

            self.sendDelete()

            theNet().remove(self.performerScene)

        VisItem.delete(self, isInitialized, negMsgHandler)
Beispiel #16
0
    def run(self, runmode, negMsgHandler=None):
        if runmode==RUN_ALL:
            _infoer.function = str(self.run) 
            _infoer.write("go coViewpointMgr")

            VisItem.run(self, runmode, negMsgHandler)
            self.sendFlyingMode()
            self.sendClipplaneMode()
Beispiel #17
0
    def run(self, runmode, negMsgHandler=None):
        if runmode == RUN_ALL:
            _infoer.function = str(self.run)
            _infoer.write("go coViewpointMgr")

            VisItem.run(self, runmode, negMsgHandler)
            self.sendFlyingMode()
            self.sendClipplaneMode()
Beispiel #18
0
 def delete(self, isInitialized, negMsgHandler=None):
     """ delete this CoviseVis: remove the module """
     _infoer.function = str(self.delete)
     _infoer.write(" ")
     if isInitialized:
         theNet().remove(self.performerScene)
         theNet().remove(self.addAttribute)
     VisItem.delete(self, isInitialized, negMsgHandler)
Beispiel #19
0
 def __init__(self):
     _infoer.function = str(self.__init__)
     _infoer.write("")
     VisItem.__init__(self, VIS_DOCUMENT, 'DocumentMgr')
     self.params = coDocumentMgrParams()
     self.name = self.params.name
     self.params.isVisible = True
     self.__initBase()
Beispiel #20
0
 def __init__(self):
     VisItem.__init__(self, TYPE_SCENEGRAPH_MGR, 'SceneGraphMgr')
     globalKeyHandler().globalSceneGraphMgrKey = self.key
     self.params = coSceneGraphMgrParams()
     self.__inRecreation = False
     self.sceneGraphItems_maximumIndex = -1
     global update_counter
     update_counter = -1
Beispiel #21
0
 def __init__(self):
     _infoer.function = str(self.__init__)
     _infoer.write("")
     VisItem.__init__(self, VIS_DOCUMENT, 'DocumentMgr')
     self.params = coDocumentMgrParams()
     self.name = self.params.name
     self.params.isVisible = True
     self.__initBase()
Beispiel #22
0
    def __init__(self):
        VisItem.__init__(self, TYPE_VIEWPOINT_MGR, 'ViewpointMgr')
        self.params = coViewpointMgrParams()
        self.name = self.params.name

        # tell cover to send the default viewpoints
        msg = coGRKeyWordMsg("sendDefaultViewPoint", True)
        covise.sendRendMsg(msg.c_str())
Beispiel #23
0
 def __init__(self):
     VisItem.__init__(self, TYPE_VIEWPOINT_MGR, 'ViewpointMgr')
     self.params = coViewpointMgrParams()
     self.name = self.params.name
     
     # tell cover to send the default viewpoints
     msg = coGRKeyWordMsg( "sendDefaultViewPoint" , True)
     covise.sendRendMsg(msg.c_str())
Beispiel #24
0
 def delete(self, isInitialized, negMsgHandler=None):
     ''' delete this CoviseVis: remove the module '''
     _infoer.function = str(self.delete)
     _infoer.write(" ")
     if isInitialized:
         theNet().remove(self.performerScene)
         theNet().remove(self.addAttribute)
     VisItem.delete(self, isInitialized, negMsgHandler)
Beispiel #25
0
 def __init__(self):
     VisItem.__init__(self, TYPE_SCENEGRAPH_MGR, 'SceneGraphMgr')
     globalKeyHandler().globalSceneGraphMgrKey = self.key
     self.params = coSceneGraphMgrParams()
     self.__inRecreation = False
     self.sceneGraphItems_maximumIndex = -1
     global update_counter
     update_counter = -1
Beispiel #26
0
 def delete(self, isInitialized, negMsgHandler=None):
     ''' delete this VisItem: remove the module '''
     _infoer.function = str(self.delete)
     _infoer.write(" ")
     if isInitialized:
         if hasattr(self, '_module') and self._module:
             theNet().remove(self._module)
     VisItem.delete(self, isInitialized, negMsgHandler)
Beispiel #27
0
    def recreate(self, negMsgHandler, parentKey, offset):
        coDNAMgrParams.mergeDefaultParams(self.params) # explicitly call mergeDefaultParams of this class
        # discard mapping from coprj, since we get different registered scene graph items from COVER
        #self.params.openCOVER2key = {}
        VisItem.recreate(self, negMsgHandler, parentKey, offset)
        globalKeyHandler().globalDNAMgrKey = self.key

        self.sendVisibility()
Beispiel #28
0
    def recreate(self, negMsgHandler, parentKey, offset):
        coDNAMgrParams.mergeDefaultParams(
            self.params)  # explicitly call mergeDefaultParams of this class
        # discard mapping from coprj, since we get different registered scene graph items from COVER
        #self.params.openCOVER2key = {}
        VisItem.recreate(self, negMsgHandler, parentKey, offset)
        globalKeyHandler().globalDNAMgrKey = self.key

        self.sendVisibility()
Beispiel #29
0
    def recreate(self, negMsgHandler, parentKey, offset):
        self.__inRecreation = True
        self.sceneGraphItems_maximumIndex = -1
        coSceneGraphMgrParams.mergeDefaultParams(self.params) # explicitly call mergeDefaultParams of this class
        VisItem.recreate(self, negMsgHandler, parentKey, offset)
        globalKeyHandler().globalSceneGraphMgrKey = self.key
        global update_counter
        update_counter = -1

        self.sendVisibility()
Beispiel #30
0
 def __init(self):
     """ start COVISE Module and connect output to COVER """
     if self.__addAttribute==None :
         self.__addAttribute = AddAttribute()
         theNet().add(self.__addAttribute)
         self.__addAttribute.set_attrName( "COLOR" )
         addAttributeIn = ConnectionPoint( self.__addAttribute, 'inObject' )
         self.__addAttributeOut = ConnectionPoint( self.__addAttribute, 'outObject' )
         connect( self.importModule.geoConnectionPoint(), addAttributeIn )
         VisItem.connectToCover( self, self )
Beispiel #31
0
 def __init(self):
     """ start COVISE Module and connect output to COVER """
     if self.__addAttribute == None:
         self.__addAttribute = AddAttribute()
         theNet().add(self.__addAttribute)
         self.__addAttribute.set_attrName("COLOR")
         addAttributeIn = ConnectionPoint(self.__addAttribute, 'inObject')
         self.__addAttributeOut = ConnectionPoint(self.__addAttribute,
                                                  'outObject')
         connect(self.importModule.geoConnectionPoint(), addAttributeIn)
         VisItem.connectToCover(self, self)
Beispiel #32
0
 def recreate(self, negMsgHandler, parentKey, offset):
     coDNAItemParams.mergeDefaultParams(
         self.params)  # explicitly call mergeDefaultParams of this class
     PartTransform.recreate(self, negMsgHandler, parentKey, offset)
     VisItem.recreate(self, negMsgHandler, parentKey, offset)
     for conn in self.params.connectionPoints:
         self.sendConnections(conn, [
             self.params.connectionPoints[conn],
             self.params.connectionPointsDisable[conn]
         ])
     self.sendTransformation()
Beispiel #33
0
 def run(self, runmode, negMsgHandler=None):
     if runmode==RUN_ALL:
         _infoer.function = str(self.run)
         _infoer.write("go")
         self.__update()
         if not self.__connected :#and self.params.isVisible:
             VisItem.connectToCover( self, self )
             self.__connected=True
         if not self.__loaded:
             saveExecute(self.coverDocument)
             self.__loaded=True
Beispiel #34
0
 def __init(self, negMsgHandler):
     """called from __update
        start rwCovise and connects to COVER
        send params to GUI"""
     _infoer.function = str(self.__init)
     _infoer.write(" ")
     if self.rwCovise == None:
         self.rwCovise = RWCovise()
         theNet().add(self.rwCovise)
         VisItem.connectToCover(self, self)
         self.__connected = True
Beispiel #35
0
 def run(self, runmode, negMsgHandler=None):
     if runmode == RUN_ALL:
         _infoer.function = str(self.run)
         _infoer.write("go")
         self.__update(negMsgHandler)
         if not self.__connected:
             VisItem.connectToCover(self, self)
             self.__connected = True
         if self.__loaded == None or self.__loaded != self.params.filename:
             saveExecute(self.rwCovise)
             self.__loaded = self.params.filename
Beispiel #36
0
    def recreate(self, negMsgHandler, parentKey, offset):
        self.__inRecreation = True
        self.sceneGraphItems_maximumIndex = -1
        coSceneGraphMgrParams.mergeDefaultParams(
            self.params)  # explicitly call mergeDefaultParams of this class
        VisItem.recreate(self, negMsgHandler, parentKey, offset)
        globalKeyHandler().globalSceneGraphMgrKey = self.key
        global update_counter
        update_counter = -1

        self.sendVisibility()
Beispiel #37
0
 def run(self, runmode, negMsgHandler=None):
     if runmode == RUN_ALL:
         _infoer.function = str(self.run)
         _infoer.write("go")
         self.__update()
         if not self.__connected:  #and self.params.isVisible:
             VisItem.connectToCover(self, self)
             self.__connected = True
         if not self.__loaded:
             saveExecute(self.coverDocument)
             self.__loaded = True
Beispiel #38
0
    def recreate(self, negMsgHandler, parentKey, offset):
        """ recreate is called after all classes of the session have been unpickled """
        _infoer.function = str(self.recreate)
        _infoer.write(" ")
        coDocumentMgrParams.mergeDefaultParams(self.params) # explicitly call mergeDefaultParams of this class
        self.__initBase()
        VisItem.recreate(self, negMsgHandler, parentKey, offset)
        self.params.changed = False

        if getExistingFilename(self.params.imageName) == None:
            raise CoviseFileNotFoundError(self.params.imageName)
Beispiel #39
0
 def recreate(self, negMsgHandler, parentKey, offset):
     SceneObjectVisParams.mergeDefaultParams(self.params) # explicitly call mergeDefaultParams of this class
     self.__initBase()
     VisItem.recreate(self, negMsgHandler, parentKey, offset)
     #add offset to children
     newchildren = []
     for child in self.params.children:
         newchildren.append(child+offset)
     self.params.children = newchildren
     if self.params.filename == None:
         raise CoviseFileNotFoundError(self.params.filename)
Beispiel #40
0
    def __init__(self):
        VisItem.__init__(self, VIS_VRML, self.__class__.__name__)
        self.params = VrmlVisParams()
        self.params.isVisible = True

        sgm = globalKeyHandler().getObject(globalKeyHandler().globalSceneGraphMgrKey)
        # immediately increase maximumIndex by at least 1, so if for some reason we don't get any SceneGraphItems, the next VrmlVis still uses another startIndex
        sgm.sceneGraphItems_maximumIndex = sgm.sceneGraphItems_maximumIndex + 1
        self.params.sceneGraphItems_startIndex = sgm.sceneGraphItems_maximumIndex

        self.__initBase()
Beispiel #41
0
 def recreate(self, negMsgHandler, parentKey, offset,
              modName, geoInputNames=['meshIn'] , \
     octtreeInputNames=[], geoSampleNames=[], dataSampleNames=[],\
     dataInputNames=[], scalarInputNames=[], twoDInputNames=[], sampleType=1, bbox = True, octtree= True ) :
     #geoInputNames, octtreeInputNames, geoSampleNames, dataSampleNames,\
     #                dataInputNames, scalarInputNames, twoDInputNames, bbox, octtree   ):
     ''' recreate is called after all classes of the session have been unpickled '''
     PartModuleVisParams.mergeDefaultParams(self.params) # explicitly call mergeDefaultParams of this class
     #self.params.mergeDefaultParams()
     self._initBase(modName, geoInputNames, octtreeInputNames, geoSampleNames, dataSampleNames,\
                     dataInputNames, scalarInputNames, twoDInputNames, sampleType, bbox, octtree )
     VisItem.recreate(self, negMsgHandler, parentKey, offset)
Beispiel #42
0
 def __init__(self,modName, typeNr, name='VisItem', geoInputNames=['GridIn0'] , \
     octtreeInputNames=[], geoSampleNames=[], dataSampleNames=[], \
     dataInputNames=[], scalarInputNames=[], twoDInputNames=[], sampleType=1, bbox = True, octtree= True):
     '''name of the module, list of the geoInputName (meshIn) of the module, 
        typeNr of the visItem, name of the visitem and module of the visitem
        octtreeInputNames of the module, geoSampleNames of the module, dataSamplenames of the module
        dataInputNames of the module, scalarInputNames of the module, 2DPartInputNames of the module'''
     
     VisItem.__init__(self, typeNr, name)
     self.params = PartModuleVisParams()
     self._initBase( modName, geoInputNames, octtreeInputNames, geoSampleNames, dataSampleNames, \
                             dataInputNames, scalarInputNames, twoDInputNames, sampleType, bbox, octtree)
Beispiel #43
0
    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)
Beispiel #44
0
    def recreate(self, negMsgHandler, parentKey, offset):
        """ recreate is called after all classes of the session have been unpickled """
        _infoer.function = str(self.recreate)
        _infoer.write(" ")
        coDocumentMgrParams.mergeDefaultParams(
            self.params)  # explicitly call mergeDefaultParams of this class
        self.__initBase()
        VisItem.recreate(self, negMsgHandler, parentKey, offset)
        self.params.changed = False

        if getExistingFilename(self.params.imageName) == None:
            raise CoviseFileNotFoundError(self.params.imageName)
Beispiel #45
0
 def recreate(self, negMsgHandler, parentKey, offset):
     SceneObjectVisParams.mergeDefaultParams(
         self.params)  # explicitly call mergeDefaultParams of this class
     self.__initBase()
     VisItem.recreate(self, negMsgHandler, parentKey, offset)
     #add offset to children
     newchildren = []
     for child in self.params.children:
         newchildren.append(child + offset)
     self.params.children = newchildren
     if self.params.filename == None:
         raise CoviseFileNotFoundError(self.params.filename)
Beispiel #46
0
    def __init__(self):
        VisItem.__init__(self, VIS_VRML, self.__class__.__name__)
        self.params = VrmlVisParams()
        self.params.isVisible = True

        sgm = globalKeyHandler().getObject(
            globalKeyHandler().globalSceneGraphMgrKey)
        # immediately increase maximumIndex by at least 1, so if for some reason we don't get any SceneGraphItems, the next VrmlVis still uses another startIndex
        sgm.sceneGraphItems_maximumIndex = sgm.sceneGraphItems_maximumIndex + 1
        self.params.sceneGraphItems_startIndex = sgm.sceneGraphItems_maximumIndex

        self.__initBase()
Beispiel #47
0
    def __init__(self,modName, typeNr, name='VisItem', geoInputNames=['GridIn0'] , \
        octtreeInputNames=[], geoSampleNames=[], dataSampleNames=[], \
        dataInputNames=[], scalarInputNames=[], twoDInputNames=[], sampleType=1, bbox = True, octtree= True):
        '''name of the module, list of the geoInputName (meshIn) of the module, 
           typeNr of the visItem, name of the visitem and module of the visitem
           octtreeInputNames of the module, geoSampleNames of the module, dataSamplenames of the module
           dataInputNames of the module, scalarInputNames of the module, 2DPartInputNames of the module'''

        VisItem.__init__(self, typeNr, name)
        self.params = PartModuleVisParams()
        self._initBase( modName, geoInputNames, octtreeInputNames, geoSampleNames, dataSampleNames, \
                                dataInputNames, scalarInputNames, twoDInputNames, sampleType, bbox, octtree)
Beispiel #48
0
    def __init(self):
        """ start COVISE modules and connect output to COVER """
        if self.__colors==None and self.__collect==None:
            self.__colors = Colors()
            theNet().add(self.__colors)
            self.__colorsIn = ConnectionPoint(self.__colors, 'GridIn0')

            self.__collect = Collect()
            theNet().add(self.__collect)
            self.__collectOut = ConnectionPoint(self.__collect, 'GeometryOut0')
            connect( self.importModule.geoConnectionPoint(), ConnectionPoint(self.__collect, 'GridIn0') )

            VisItem.connectToCover( self, self )
Beispiel #49
0
 def recreate(self, negMsgHandler, parentKey, offset,
              modName, geoInputNames=['meshIn'] , \
     octtreeInputNames=[], geoSampleNames=[], dataSampleNames=[],\
     dataInputNames=[], scalarInputNames=[], twoDInputNames=[], sampleType=1, bbox = True, octtree= True ) :
     #geoInputNames, octtreeInputNames, geoSampleNames, dataSampleNames,\
     #                dataInputNames, scalarInputNames, twoDInputNames, bbox, octtree   ):
     ''' recreate is called after all classes of the session have been unpickled '''
     PartModuleVisParams.mergeDefaultParams(
         self.params)  # explicitly call mergeDefaultParams of this class
     #self.params.mergeDefaultParams()
     self._initBase(modName, geoInputNames, octtreeInputNames, geoSampleNames, dataSampleNames,\
                     dataInputNames, scalarInputNames, twoDInputNames, sampleType, bbox, octtree )
     VisItem.recreate(self, negMsgHandler, parentKey, offset)
Beispiel #50
0
    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()
Beispiel #51
0
    def __init(self):
        """ start COVISE modules and connect output to COVER """
        if self.__colors == None and self.__collect == None:
            self.__colors = Colors()
            theNet().add(self.__colors)
            self.__colorsIn = ConnectionPoint(self.__colors, 'GridIn0')

            self.__collect = Collect()
            theNet().add(self.__collect)
            self.__collectOut = ConnectionPoint(self.__collect, 'GeometryOut0')
            connect(self.importModule.geoConnectionPoint(),
                    ConnectionPoint(self.__collect, 'GridIn0'))

            VisItem.connectToCover(self, self)
Beispiel #52
0
 def recreate(self, negMsgHandler, parentKey, offset):
     """ recreate is called after all classes of the session have been unpickled """
     coViewpointParams.mergeDefaultParams(self.params) # explicitly call mergeDefaultParams of this class
     #do not recreate default viewpoints
     if self.params.view == 'default' or self.params.id == None:
         self.delete(False, negMsgHandler)
         return
     VisItem.recreate(self, negMsgHandler, parentKey, offset)
     self.params.confirmed = False
     self.params.changed = False
     # the id is not used by cover
     # could be out of sync
     msg = coGRCreateViewpointMsg( self.params.name, self.params.id, self.params.view, self.params.clipplane )
     covise.sendRendMsg(msg.c_str())
Beispiel #53
0
    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()
Beispiel #54
0
 def delete(self, isInitialized, negMsgHandler=None):
     if isInitialized:
         scgrMgr = globalKeyHandler().getObject(
             globalKeyHandler().globalSceneGraphMgrKey)
         if scgrMgr:  # if no scgrMgr exists, it has already been deleted (no need to delete the key)
             scgrMgr.deleteKey(self.key)
     return VisItem.delete(self, isInitialized, negMsgHandler)
Beispiel #55
0
 def recreate(self, negMsgHandler, parentKey, offset):
     """ recreate is called after all classes of the session have been unpickled """
     coViewpointParams.mergeDefaultParams(
         self.params)  # explicitly call mergeDefaultParams of this class
     #do not recreate default viewpoints
     if self.params.view == 'default' or self.params.id == None:
         self.delete(False, negMsgHandler)
         return
     VisItem.recreate(self, negMsgHandler, parentKey, offset)
     self.params.confirmed = False
     self.params.changed = False
     # the id is not used by cover
     # could be out of sync
     msg = coGRCreateViewpointMsg(self.params.name, self.params.id,
                                  self.params.view, self.params.clipplane)
     covise.sendRendMsg(msg.c_str())
Beispiel #56
0
    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
Beispiel #57
0
 def registerCOVISEkey( self, covise_key):
     """ called during registration if key received from COVER
         + update states in COVER
     """
     (registered, firstTime) = VisItem.registerCOVISEkey( self, covise_key)
     if registered:
         self.sendInteractorStatus()
         self.sendSmokeStatus()
         return (True, firstTime)
     return (False, False)
Beispiel #58
0
    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
Beispiel #59
0
    def run(self, runmode, negMsgHandler=None):
        if runmode == RUN_ALL:
            _infoer.function = str(self.run)
            _infoer.write("go")
            self.__update()
            if not self.__connected and self.params.isVisible:
                VisItem.connectToCover(self, self)
                self.__connected = True
            if not self.__loaded:
                saveExecute(self.performerScene)
                self.__loaded = True

        # dont auto-activate sensors in recreation
        if negMsgHandler and negMsgHandler.getInRecreation() == False:
            # bei run() die sensoren starten
            # wird (ausserhalb von recreate) nur vom presentation manager aufgerufen
            for sensorID in self.params.autoActiveSensorIDs:
                msg = coGRObjSensorEventMsg(coGRMsg.SENSOR_EVENT, self.params.filename, sensorID, True, True)
                covise.sendRendMsg(msg.c_str())
                msg = coGRObjSensorEventMsg(coGRMsg.SENSOR_EVENT, self.params.filename, sensorID, True, False)
                covise.sendRendMsg(msg.c_str())