Пример #1
0
    def __update(self):
        """ do init if necessary; update module parameters """
        self.__init()

        # update input
        dataInConnect = self.importModule.dataConnectionPoint(
            self.params.variable)
        if not self.__lastDataConnection == None:
            disconnect(self.__lastDataConnection, self.__colorsIn)
        else:
            theNet().connect(self.__colors, 'TextureOut0', self.__collect,
                             'TextureIn0')

        if dataInConnect:
            connect(
                self.importModule.dataConnectionPoint(self.params.variable),
                self.__colorsIn)
        self.__lastDataConnection = self.importModule.dataConnectionPoint(
            self.params.variable)

        _infoer.function = str(self.__update)
        _infoer.write(": updating to variable " + self.params.variable)

        # update colormap settings
        self.__colors.set_numSteps(self.params.numSteps)
Пример #2
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()
Пример #3
0
 def testTransientReduceSetData(self):
     moduleCount = theNet().moduleCount()
     gip_core = self._TransientGroup()
     gip = ImportGroupReduceSet(gip_core)
     gip.setReductionFactor(2)
     value = 'Pressure'
     c = Colors()
     theNet().add(c)
     connect( gip.dataConnectionPoint(value), ConnectionPoint( c, 'Data' ) )
     coll = Collect()
     theNet().add(coll)
     connect( gip.geoConnectionPoint(), ConnectionPoint( coll, 'grid' ) )
     theNet().connect( c, 'texture', coll, 'textures' )
     theNet().connect( coll, 'geometry',  globalRenderer()._module, 'RenderData')
     gip.executeGeo()
     gip.executeData(value)
     (a,b) = gip.getDataMinMax(value)
     self.assertEqual((a,b),(-0.018360999999999999, 2.0))
     # delete
     theNet().remove(c)
     theNet().remove(coll)
     gip.delete()
     gip_core.delete()
     self._RemoveImportGroupModules()
     self.assertEqual(theNet().moduleCount(), moduleCount)
Пример #4
0
    def executeData(self, varName):
        self.__initData(varName)

        # reconnect data
        if varName in self.__dataInConnectionPoints.keys():
            theNet().disconnectAllFromModulePort(
                self.__dataInConnectionPoints[varName].module,
                self.__dataInConnectionPoints[varName].port)
            connect(ParentClass.dataConnectionPoint(self, varName),
                    self.__dataInConnectionPoints[varName])

        # wenn voriges Modul tatsaechlich executed wurde, dann nicht mehr selbst executen
        if ParentClass.executeData(self, varName) == True:
            self.__needExecuteData[varName] = False
            return True

        if not self.__needExecuteData[varName]:
            return False
        self.__needExecuteData[varName] = False

        if varName in self.__dataInConnectionPoints.keys():
            saveExecute(self.__dataInConnectionPoints[varName].module)
            return True

        return False
Пример #5
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()
Пример #6
0
 def testTransientReduceSetData(self):
     moduleCount = theNet().moduleCount()
     gip_core = self._TransientGroup()
     gip = ImportGroupReduceSet(gip_core)
     gip.setReductionFactor(2)
     value = 'Pressure'
     c = Colors()
     theNet().add(c)
     connect(gip.dataConnectionPoint(value), ConnectionPoint(c, 'Data'))
     coll = Collect()
     theNet().add(coll)
     connect(gip.geoConnectionPoint(), ConnectionPoint(coll, 'grid'))
     theNet().connect(c, 'texture', coll, 'textures')
     theNet().connect(coll, 'geometry',
                      globalRenderer()._module, 'RenderData')
     gip.executeGeo()
     gip.executeData(value)
     (a, b) = gip.getDataMinMax(value)
     self.assertEqual((a, b), (-0.018360999999999999, 2.0))
     # delete
     theNet().remove(c)
     theNet().remove(coll)
     gip.delete()
     gip_core.delete()
     self._RemoveImportGroupModules()
     self.assertEqual(theNet().moduleCount(), moduleCount)
Пример #7
0
 def getBox(self, forceExecute = False):
     """ return the bounding box """
     if self._bb==None:
         self._bb = BoundingBox()
         theNet().add( self._bb)
         connect( self.geoConnectionPoint(), ConnectionPoint( self._bb, 'GridIn0' ) )
         # Clear info queue so we dont read a previous BB output.
         # (If something goes wrong with the queue, this could be the reason.)
         coviseStartup.globalReceiverThread.infoQueue.clear()
         if not self.executeGeo():
             saveExecute(self._bb)
         boxParser = BoundingBoxParser()
         boxParser.parseQueue(coviseStartup.globalReceiverThread.infoQueue)
         self._boundingBox = boxParser.getBox()
     elif forceExecute:
         # Clear info queue so we dont read a previous BB output.
         # (If something goes wrong with the queue, this could be the reason.)
         coviseStartup.globalReceiverThread.infoQueue.clear()
         if not self.executeGeo():
             saveExecute(self._bb)
         boxParser = BoundingBoxParser()
         boxParser.parseQueue(coviseStartup.globalReceiverThread.infoQueue)
         try:
             oldbb = self._boundingBox
             self._boundingBox = boxParser.getBox()
         except (ValueError):
             self._boundingBox = oldbb
     return self._boundingBox
Пример #8
0
    def executeOct(self):
        self.octTreeConnectionPoint()
        one_executed = False
        #quickfix
        #save/loading of a 2d composed probing point does not work with this
        #for part in self._parts:
        #    if part.executeOct():
        #        one_executed = True
        numPorts = 0
        numModules = 0
        for part in self._parts:
            # dont reconnect BlockCollect inter-connections
            if (numPorts % 15 == 0) and (numModules != 0):
                numPorts += 1
            theNet().disconnectAllFromModulePort(self._collectOct[numModules].objInConnectionPoint(numPorts).module, self._collectOct[numModules].objInConnectionPoint(numPorts).port)
            connect(part.octTreeConnectionPoint(), self._collectOct[numModules].objInConnectionPoint(numPorts))
            numPorts = numPorts + 1
            if numPorts % 15 == 0:
                numModules = numModules +1
                numPorts = 0

            if part.executeOct():
                one_executed = True

        if not one_executed and self._firstTimeOct:
            for bc in self._collectOct:
                bc.execute()
                one_executed = True
        self._firstTimeOct = False
        return one_executed
Пример #9
0
 def dataConnectionPoint(self, varname):
     if not varname in self._assembleUsg:
         self._initAssemble(varname)
         connect(ImportGroupModule.geoConnectionPoint(self),
                 self._assembleUsg[varname].geoInConnectionPoint())
         connect(ImportGroupModule.dataConnectionPoint(self, varname),
                 self._assembleUsg[varname].dataInConnectionPoint())
     return self._assembleUsg[varname].dataOutConnectionPoint()
Пример #10
0
 def geoConnectionPoint(self, varname=None):
     if varname==None:
         if self._assembleGeo==None:
             self._initAssembleGeo()
             connect( ImportGroupModule.geoConnectionPoint(self), self._assembleGeo.geoInConnectionPoint() )
         return  self._assembleGeo.geoOutConnectionPoint()
     else:
         self.dataConnectionPoint(varname)
         return self._assembleUsg[varname].geoOutConnectionPoint()
Пример #11
0
    def _update(self, negMsgHandler):
        ''' _update is called from the run method to update the module parameter before execution
            + do init the module if necessary
            update module parameters should be realized in the parent class'''
        self._init(negMsgHandler)

        if not hasattr(self, 'importModule'):
            return

        # update input
        # vec variable
        # vec variable is not changable from the Gui at the moment

        #scalar variable
        if not self._lastScalarConnection == None:
            for scalarInput in self._scalarInputNames:
                disconnect(self._lastScalarConnection,
                           ConnectionPoint(self._module, scalarInput))
        if hasattr(self.params, 'secondVariable') and len(
                self._scalarInputNames
        ) > 0 and not self.params.secondVariable == None:
            self.importModule.executeData(self.params.secondVariable)
            scalarInConnect = self.importModule.dataConnectionPoint(
                self.params.secondVariable)
            if scalarInConnect:
                for scalarInput in self._scalarInputNames:
                    connect(scalarInConnect,
                            ConnectionPoint(self._module, scalarInput))
                self._lastScalarConnection = scalarInConnect

        # starting points from 2d part
        if not self._last2DPartConnection == None:
            part2D = globalKeyHandler().getObject(self.params.use2DPartKey)
            if not part2D or not self._last2DPartConnection == part2D.importModule.geoConnectionPoint(
            ):
                for partInput in self._2DPartInputNames:
                    disconnect(self._last2DPartConnection,
                               ConnectionPoint(self._module, partInput))
                self._last2DPartConnection = None
        if len(
                self._2DPartInputNames
        ) > 0 and self.params.use2DPartKey != None and self.params.use2DPartKey >= 0 and self._last2DPartConnection == None:
            # sampling removed at the moment
            part2D = globalKeyHandler().getObject(self.params.use2DPartKey)
            part2D.importModule.executeGeo()
            for partInput in self._2DPartInputNames:
                connect(part2D.importModule.geoConnectionPoint(),
                        ConnectionPoint(self._module, partInput))
                if self._firstGeoForVars:
                    self._firstGeoForVars = False
                    #setTransform to module
                    negMsgHandler.run(self.params.use2DPartKey)
            self._last2DPartConnection = part2D.importModule.geoConnectionPoint(
            )

        self._module.setTitle(self.params.name)
Пример #12
0
 def _init(self, negMsgHandler, module, colorMapPortName = 'ColormapIn0'):
     '''_init is called from _update
        connect color map
     '''
     # check if ColorCreator already exists
     if len(self.objects)==0:
         self._initColor(negMsgHandler)
     if len(self.objects)>0 and self.__colorMap:
         self._visualizerColorCP = ConnectionPoint(module, colorMapPortName)
         connect( (self.objects[0]).colorMapConnectionPoint(), self._visualizerColorCP )
Пример #13
0
 def geoConnectionPoint(self, varname=None):
     if varname == None:
         if self._assembleGeo == None:
             self._initAssembleGeo()
             connect(ImportGroupModule.geoConnectionPoint(self),
                     self._assembleGeo.geoInConnectionPoint())
         return self._assembleGeo.geoOutConnectionPoint()
     else:
         self.dataConnectionPoint(varname)
         return self._assembleUsg[varname].geoOutConnectionPoint()
Пример #14
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 )
Пример #15
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)
Пример #16
0
    def run(self, runmode, negMsgHandler, module, afterRecreation=False):
        if os.getenv('VR_PREPARE_DEBUG_RUN'):
            print("PartColoredVis.run")
        '''create a new visulisation'''
        #assert negMsgHandler

        if runmode==RUN_ALL:
            if not hasattr(self, 'importModule'):
                return False

            _infoer.function = str(self.run)
            _infoer.write("go colored vis for %s" % self.params.variable)


            PartColoredVis._update(self, negMsgHandler)

            #update colortable at the first time after recreation
            #if afterRecreation and len(self.objects)>0:
            #    colorCreator = self.objects[0]
            #    return colorCreator.run(RUN_ALL)

            #if not self.__needExecute:
            #    # TODO: self.__needExecute zu oft auf False -> geaenderte color map wird nicht uebernommen
            #    #return False
            #self.__needExecute = False

            """
            # to be sure that the import module loaded all data
            self.importModule.executeOct()

            if not self.importModule.executeData(self.currentVariable()):
                if len(self.objects)>0:
                    colorCreator = self.objects[0]
                    # the colorCreator contains a colors module which is connected to the import of the tracer
                    # implicit execution of the tracer module
                    colorCreator.run(RUN_ALL)
                    return True
                #else:
                #    module.execute()
            """

            if len(self.objects)>0:
                colorCreator = self.objects[0]
                if self._visualizerColorCP:
                    # Since we dont know if the visualizers module is actually ready to execute,
                    # we dont want it to be executed along with the colors module.
                    # Therefore the disconnect.
                    disconnect(colorCreator.colorMapConnectionPoint(), self._visualizerColorCP)
                colorCreator.run(RUN_ALL)
                if self._visualizerColorCP:
                    connect(colorCreator.colorMapConnectionPoint(), self._visualizerColorCP)

            return False # always return False because the visualizers module is disconnected and wont be executed
Пример #17
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 )
Пример #18
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)
Пример #19
0
    def connectToCover(self, visConnectionModule):
        self.__creationModule = visConnectionModule
        VRPCoviseNetAccess.connect(visConnectionModule.connectionPoint(),
                                   globalRenderer().connectionPoint())

        if os.getenv('VR_PREPARE_DEBUG_VISITEMS_DIR'):
            #filename = os.getenv('VR_PREPARE_DEBUG_VISITEMS_DIR') + '/' + self.params.name + "_%s.covise" % self.key
            #rw = RWCoviseModule(filename, True)
            #filename = rw.gridPath()
            #connect( visConnectionModule.connectionPoint(), rw.inConnectionPoint() )
            filename = os.getenv('VR_PREPARE_DEBUG_VISITEMS_DIR') + '/' \
                       + self.params.name + "_" + str(self.key) + ".covise"
            self.__debugRwModule = RWCoviseModule(filename, True)
            connect(visConnectionModule.connectionPoint(),
                    self.__debugRwModule.inConnectionPoint())
Пример #20
0
def testGroupData(gip):
    value = 'Temperature'
    c = Colors()
    theNet().add(c)
    connect( gip.dataConnectionPoint(value), ConnectionPoint( c, 'Data' ) )
    gip.executeData(value)

    coll = Collect()
    theNet().add(coll)
    connect( gip.geoConnectionPoint(value), ConnectionPoint( coll, 'grid' ) )
    theNet().connect( c, 'texture', coll, 'textures' )
    r = Renderer()
    theNet().add(r)
    theNet().connect( coll, 'geometry', r, 'RenderData')
    c.execute()
Пример #21
0
    def connectToCover( self, visConnectionModule ):
        self.__creationModule = visConnectionModule
        VRPCoviseNetAccess.connect(
            visConnectionModule.connectionPoint(),
            globalRenderer().connectionPoint() )

        if os.getenv('VR_PREPARE_DEBUG_VISITEMS_DIR'):
            #filename = os.getenv('VR_PREPARE_DEBUG_VISITEMS_DIR') + '/' + self.params.name + "_%s.covise" % self.key
            #rw = RWCoviseModule(filename, True)
            #filename = rw.gridPath()
            #connect( visConnectionModule.connectionPoint(), rw.inConnectionPoint() )
            filename = os.getenv('VR_PREPARE_DEBUG_VISITEMS_DIR') + '/' \
                       + self.params.name + "_" + str(self.key) + ".covise"
            self.__debugRwModule = RWCoviseModule(filename, True)
            connect( visConnectionModule.connectionPoint(), self.__debugRwModule.inConnectionPoint() )
Пример #22
0
    def getDataMinMax( self, variable):
        """ return min and max value of variable """
        if variable==None:
            return

        if self._minMax==None:
            self._minMax = Colors()
            theNet().add(self._minMax)
        theNet().disconnectAllFromModulePort( self._minMax, 'DataIn0' )
        connect(self.dataConnectionPoint(variable), ConnectionPoint(self._minMax, 'DataIn0'))

        if not self.executeData( variable ):
            saveExecute(self._minMax)
            
        return ( float(self._minMax.getParamValue('MinMax')[0]),\
                 float(self._minMax.getParamValue('MinMax')[1]) )
Пример #23
0
    def getDataMinMax(self, variable):
        """ return min and max value of variable """
        if variable==None:
            return

        if self._minMax==None:
            self._minMax = Colors()
            theNet().add(self._minMax)
        theNet().disconnectAllFromModulePort( self._minMax, 'DataIn0' )
        connect(self.dataConnectionPoint(variable), ConnectionPoint(self._minMax, 'DataIn0'))

        self.executeData( variable )
        saveExecute(self._minMax)

        return ( float(self._minMax.getParamValue('MinMax')[0]),\
                 float(self._minMax.getParamValue('MinMax')[1]) )
Пример #24
0
    def getBoxFromGeoRWCovise(self):
        """ return the bounding box from the originally unfiltered geometry """

        if self.__boundingBoxFromGeoRWCovise == None:
            self.__bbFromGeoRWCovise = BoundingBox()
            theNet().add(self.__bbFromGeoRWCovise)
            connect( self._geo.connectionPoint(), ConnectionPoint(self.__bbFromGeoRWCovise, 'GridIn0'))

            # Clear info queue so we dont read a previous BB output.
            # (If something goes wrong with the queue, this could be the reason.)
            coviseStartup.globalReceiverThread.infoQueue_.clear()
            saveExecute(self.__bbFromGeoRWCovise)
            boxParser = BoundingBoxParser()
            boxParser.parseQueue(coviseStartup.globalReceiverThread.infoQueue_)
            self.__boundingBoxFromGeoRWCovise = boxParser.getBox()

        return self.__boundingBoxFromGeoRWCovise
Пример #25
0
    def __initGeo(self):
        # init rotation
        if self.__rotAngle == 0 and self.__rotations == []:
            pass
        else:
            if self.__rotAngle != 0 and self.__rotations == []:
                self.__rotations.append(TransformModule())
                self.__rotations[0].setRotation(self.__rotAngle, self.__rotX,
                                                self.__rotY, self.__rotZ)
                self.__needExecuteGeo = True

                self.__geoInConnectionPoint = self.__rotations[
                    0].geoInConnectionPoint()
                if self.__translation == None:
                    self.__geoConnectionPoint = self.__rotations[
                        0].geoOutConnectionPoint()
                else:
                    theNet().disconnectAllFromModulePort(
                        self.__translation.geoInConnectionPoint().module,
                        self.__translation.geoInConnectionPoint().port)
                    connect(self.__rotations[0].geoOutConnectionPoint(),
                            self.__translation.geoInConnectionPoint())

        # init translation
        if (self.__transX, self.__transY,
                self.__transZ) == (0, 0, 0) and self.__translation == None:
            pass
        else:
            if (self.__transX, self.__transY,
                    self.__transZ) != (0, 0, 0) and self.__translation == None:
                self.__translation = TransformModule()
                self.__translation.setTranslation(self.__transX, self.__transY,
                                                  self.__transZ)
                self.__needExecuteGeo = True

                if self.__rotations == []:
                    self.__geoInConnectionPoint = self.__translation.geoInConnectionPoint(
                    )
                else:
                    theNet().disconnectAllFromModulePort(
                        self.__rotations[0].geoOutConnectionPoint().module,
                        self.__rotations[0].geoOutConnectionPoint().port)
                    connect(self.__rotations[0].geoOutConnectionPoint(),
                            self.__translation.geoInConnectionPoint())
                self.__geoConnectionPoint = self.__translation.geoOutConnectionPoint(
                )
Пример #26
0
    def executeGeo(self):
        # reconnect geometry
        if self.__reduceSetModules != []:
            theNet().disconnectAllFromModulePort(self.__reduceSetModules[0].geoInConnectionPoint().module, self.__reduceSetModules[0].geoInConnectionPoint().port)
            connect( ParentClass.geoConnectionPoint(self), self.__reduceSetModules[0].geoInConnectionPoint() )

        # wenn voriges Modul tatsaechlich executed wurde, dann nicht mehr selbst executen
        if ParentClass.executeGeo(self) == True:
            return True

        if not self.__needExecute:
            return False
        self.__needExecute = False

        if self.__reduceSetModules != []:
            self.__reduceSetModules[0].execute()
        return True
Пример #27
0
    def _update(self, negMsgHandler):
        ''' _update is called from the run method to update the module parameter before execution
            + do init the module if necessary
            update module parameters should be realized in the parent class'''
        self._init(negMsgHandler)

        if not hasattr(self, 'importModule'):
            return
            
        # update input
        # vec variable
        # vec variable is not changable from the Gui at the moment

        #scalar variable
        if not self._lastScalarConnection==None :
            for scalarInput in self._scalarInputNames:
                disconnect( self._lastScalarConnection,  ConnectionPoint(self._module, scalarInput))
        if hasattr(self.params, 'secondVariable') and len(self._scalarInputNames)>0 and not self.params.secondVariable==None:
            self.importModule.executeData(self.params.secondVariable)
            scalarInConnect = self.importModule.dataConnectionPoint(self.params.secondVariable)
            if scalarInConnect:
                for scalarInput in self._scalarInputNames:
                    connect( scalarInConnect, ConnectionPoint(self._module, scalarInput) )
                self._lastScalarConnection=scalarInConnect

        # starting points from 2d part     
        if not self._last2DPartConnection==None:
            part2D = globalKeyHandler().getObject(self.params.use2DPartKey)
            if not part2D or not self._last2DPartConnection==part2D.importModule.geoConnectionPoint():
                for partInput in self._2DPartInputNames:
                    disconnect( self._last2DPartConnection,  ConnectionPoint(self._module, partInput))
                self._last2DPartConnection = None
        if len(self._2DPartInputNames)>0 and self.params.use2DPartKey!=None and self.params.use2DPartKey>=0 and self._last2DPartConnection==None:
            # sampling removed at the moment
            part2D = globalKeyHandler().getObject(self.params.use2DPartKey)
            part2D.importModule.executeGeo()         
            for partInput in self._2DPartInputNames:
                connect( part2D.importModule.geoConnectionPoint(), ConnectionPoint(self._module, partInput) )
                if self._firstGeoForVars:
                    self._firstGeoForVars = False
                    #setTransform to module
                    negMsgHandler.run(self.params.use2DPartKey)
            self._last2DPartConnection=part2D.importModule.geoConnectionPoint()

        self._module.setTitle( self.params.name )
Пример #28
0
    def getBoxFromGeoRWCovise(self):
        """ return the bounding box from the originally unfiltered geometry """

        if self.__boundingBoxFromGeoRWCovise == None:
            self.__bbFromGeoRWCovise = BoundingBox()
            theNet().add(self.__bbFromGeoRWCovise)
            connect(self._geo.connectionPoint(),
                    ConnectionPoint(self.__bbFromGeoRWCovise, 'GridIn0'))

            # Clear info queue so we dont read a previous BB output.
            # (If something goes wrong with the queue, this could be the reason.)
            coviseStartup.globalReceiverThread.infoQueue_.clear()
            saveExecute(self.__bbFromGeoRWCovise)
            boxParser = BoundingBoxParser()
            boxParser.parseQueue(coviseStartup.globalReceiverThread.infoQueue_)
            self.__boundingBoxFromGeoRWCovise = boxParser.getBox()

        return self.__boundingBoxFromGeoRWCovise
Пример #29
0
 def _initObj( self, bclist, connectionPoint, part_cnt):
     if len(bclist)==0:
         bc = BlockCollectModule(self.getIsTransient())
         bclist.append( bc )
         port = part_cnt
     elif part_cnt>=15:
         # number of block collect module
         nb = (part_cnt-15) / 14 + 1
         if nb==len(bclist):
             bc = BlockCollectModule(self.getIsTransient())
             bclist.append( bc )
             connect( bclist[ len(bclist)-2].objOutConnectionPoint(), bc.objInConnectionPoint(0) )
         else:
             bc =  bclist[nb]
         port = (part_cnt-15) % 14 + 1
     else:
         bc = bclist[0]
         port = part_cnt
     connect( connectionPoint, bc.objInConnectionPoint(port) )
Пример #30
0
 def testGroupData(self):
     moduleCount = theNet().moduleCount()
     gip = self._LargeSimpleGroup()        
     value = 'Temperature'
     c = Colors()
     theNet().add(c)
     connect( gip.dataConnectionPoint(value), ConnectionPoint( c, 'Data' ) )
     coll = Collect()
     theNet().add(coll)
     connect( gip.geoConnectionPoint(), ConnectionPoint( coll, 'grid' ) )
     theNet().connect( c, 'texture', coll, 'textures' )
     theNet().connect( coll, 'geometry',  globalRenderer()._module, 'RenderData')
     gip.executeGeo()
     gip.executeData(value)
     # delete
     theNet().remove(c)
     theNet().remove(coll)
     gip.delete()
     self._RemoveImportGroupModules()
     self.assertEqual(theNet().moduleCount(), moduleCount)
Пример #31
0
    def executeGeo(self):
        # reconnect geometry
        if self.__reduceSetModules != []:
            theNet().disconnectAllFromModulePort(
                self.__reduceSetModules[0].geoInConnectionPoint().module,
                self.__reduceSetModules[0].geoInConnectionPoint().port)
            connect(ParentClass.geoConnectionPoint(self),
                    self.__reduceSetModules[0].geoInConnectionPoint())

        # wenn voriges Modul tatsaechlich executed wurde, dann nicht mehr selbst executen
        if ParentClass.executeGeo(self) == True:
            return True

        if not self.__needExecute:
            return False
        self.__needExecute = False

        if self.__reduceSetModules != []:
            self.__reduceSetModules[0].execute()
        return True
Пример #32
0
    def __update(self):
        """ do init if necessary; update module parameters """
        self.__init()

        # update input
        dataInConnect = self.importModule.dataConnectionPoint(self.params.variable)
        if not self.__lastDataConnection==None :
            disconnect( self.__lastDataConnection, self.__colorsIn )
        else :
            theNet().connect(self.__colors, 'TextureOut0', self.__collect, 'TextureIn0')

        if dataInConnect:
            connect( self.importModule.dataConnectionPoint(self.params.variable), self.__colorsIn )
        self.__lastDataConnection=self.importModule.dataConnectionPoint(self.params.variable)

        _infoer.function = str(self.__update)
        _infoer.write(": updating to variable " + self.params.variable )

        # update colormap settings
        self.__colors.set_numSteps(self.params.numSteps)
Пример #33
0
    def executeGeo(self):
        self.__initGeo()

        # reconnect geometry
        if self.__geoInConnectionPoint != None:
            theNet().disconnectAllFromModulePort(self.__geoInConnectionPoint.module, self.__geoInConnectionPoint.port)
            connect(ParentClass.geoConnectionPoint(self), self.__geoInConnectionPoint)

        # wenn voriges Modul tatsaechlich executed wurde, dann nicht mehr selbst executen
        if ParentClass.executeGeo(self) == True:
            self.__needExecuteGeo = False
            return True

        if not self.__needExecuteGeo:
            return False
        self.__needExecuteGeo = False

        if self.__geoInConnectionPoint != None:
            saveExecute(self.__geoInConnectionPoint.module)
        return False
Пример #34
0
 def _initObj(self, bclist, connectionPoint, part_cnt):
     if len(bclist) == 0:
         bc = BlockCollectModule(self.getIsTransient())
         bclist.append(bc)
         port = part_cnt
     elif part_cnt >= 15:
         # number of block collect module
         nb = (part_cnt - 15) / 14 + 1
         if nb == len(bclist):
             bc = BlockCollectModule(self.getIsTransient())
             bclist.append(bc)
             connect(bclist[len(bclist) - 2].objOutConnectionPoint(),
                     bc.objInConnectionPoint(0))
         else:
             bc = bclist[nb]
         port = (part_cnt - 15) % 14 + 1
     else:
         bc = bclist[0]
         port = part_cnt
     connect(connectionPoint, bc.objInConnectionPoint(port))
Пример #35
0
 def testGroupData(self):
     moduleCount = theNet().moduleCount()
     gip = self._LargeSimpleGroup()
     value = 'Temperature'
     c = Colors()
     theNet().add(c)
     connect(gip.dataConnectionPoint(value), ConnectionPoint(c, 'Data'))
     coll = Collect()
     theNet().add(coll)
     connect(gip.geoConnectionPoint(), ConnectionPoint(coll, 'grid'))
     theNet().connect(c, 'texture', coll, 'textures')
     theNet().connect(coll, 'geometry',
                      globalRenderer()._module, 'RenderData')
     gip.executeGeo()
     gip.executeData(value)
     # delete
     theNet().remove(c)
     theNet().remove(coll)
     gip.delete()
     self._RemoveImportGroupModules()
     self.assertEqual(theNet().moduleCount(), moduleCount)
Пример #36
0
    def __init(self):
        """ start COVISE ReadCAD Module """
        if self.__readCad == None:
            self.__readCad = ReadCAD()
            theNet().add(self.__readCad)
            self.__readCadPolyOut = ConnectionPoint(self.__readCad, 'mesh')
            self.__readCadNormalsOut = ConnectionPoint(self.__readCad,
                                                       'Normals')
            self.__readCadColorsOut = ConnectionPoint(self.__readCad,
                                                      'colorOut')
            self.__readCad.set_catia_server('obie')
            self.__readCad.set_catia_server_port('7000')
            self.__readCad.set_partIndex(self.__index)
            self.__readCad.set_file_path(self.__filename)

            self.__collect = Collect()
            theNet().add(self.__collect)
            connect(self.__readCadPolyOut,
                    ConnectionPoint(self.__collect, 'GridIn0'))
            connect(self.__readCadNormalsOut,
                    ConnectionPoint(self.__collect, 'DataIn1'))
            connect(self.__readCadColorsOut,
                    ConnectionPoint(self.__collect, 'DataIn0'))
            self.__connectGeoOut = ConnectionPoint(self.__collect,
                                                   'GeometryOut0')
Пример #37
0
    def executeGeo(self):
        self.__initGeo()

        # reconnect geometry
        if self.__geoInConnectionPoint != None:
            theNet().disconnectAllFromModulePort(
                self.__geoInConnectionPoint.module,
                self.__geoInConnectionPoint.port)
            connect(ParentClass.geoConnectionPoint(self),
                    self.__geoInConnectionPoint)

        # wenn voriges Modul tatsaechlich executed wurde, dann nicht mehr selbst executen
        if ParentClass.executeGeo(self) == True:
            self.__needExecuteGeo = False
            return True

        if not self.__needExecuteGeo:
            return False
        self.__needExecuteGeo = False

        if self.__geoInConnectionPoint != None:
            saveExecute(self.__geoInConnectionPoint.module)
        return False
Пример #38
0
    def __initGeo(self):
        # init rotation
        if self.__rotAngle == 0 and self.__rotations == []:
            pass
        else:
            if self.__rotAngle != 0 and self.__rotations == []:
                self.__rotations.append(TransformModule())
                self.__rotations[0].setRotation(self.__rotAngle, self.__rotX, self.__rotY, self.__rotZ)
                self.__needExecuteGeo = True

                self.__geoInConnectionPoint = self.__rotations[0].geoInConnectionPoint()
                if self.__translation == None:
                    self.__geoConnectionPoint = self.__rotations[0].geoOutConnectionPoint()
                else:
                    theNet().disconnectAllFromModulePort(
                        self.__translation.geoInConnectionPoint().module, self.__translation.geoInConnectionPoint().port
                    )
                    connect(self.__rotations[0].geoOutConnectionPoint(), self.__translation.geoInConnectionPoint())

        # init translation
        if (self.__transX, self.__transY, self.__transZ) == (0, 0, 0) and self.__translation == None:
            pass
        else:
            if (self.__transX, self.__transY, self.__transZ) != (0, 0, 0) and self.__translation == None:
                self.__translation = TransformModule()
                self.__translation.setTranslation(self.__transX, self.__transY, self.__transZ)
                self.__needExecuteGeo = True

                if self.__rotations == []:
                    self.__geoInConnectionPoint = self.__translation.geoInConnectionPoint()
                else:
                    theNet().disconnectAllFromModulePort(
                        self.__rotations[0].geoOutConnectionPoint().module,
                        self.__rotations[0].geoOutConnectionPoint().port,
                    )
                    connect(self.__rotations[0].geoOutConnectionPoint(), self.__translation.geoInConnectionPoint())
                self.__geoConnectionPoint = self.__translation.geoOutConnectionPoint()
Пример #39
0
    def executeOct(self):
        self.octTreeConnectionPoint()
        one_executed = False
        #quickfix
        #save/loading of a 2d composed probing point does not work with this
        #for part in self._parts:
        #    if part.executeOct():
        #        one_executed = True
        numPorts = 0
        numModules = 0
        for part in self._parts:
            # dont reconnect BlockCollect inter-connections
            if (numPorts % 15 == 0) and (numModules != 0):
                numPorts += 1
            theNet().disconnectAllFromModulePort(
                self._collectOct[numModules].objInConnectionPoint(
                    numPorts).module,
                self._collectOct[numModules].objInConnectionPoint(
                    numPorts).port)
            connect(
                part.octTreeConnectionPoint(),
                self._collectOct[numModules].objInConnectionPoint(numPorts))
            numPorts = numPorts + 1
            if numPorts % 15 == 0:
                numModules = numModules + 1
                numPorts = 0

            if part.executeOct():
                one_executed = True

        if not one_executed and self._firstTimeOct:
            for bc in self._collectOct:
                bc.execute()
                one_executed = True
        self._firstTimeOct = False
        return one_executed
Пример #40
0
    def executeData(self, varName):
        self.__initData(varName)

        # reconnect data
        if varName in self.__dataInConnectionPoints.keys():
            theNet().disconnectAllFromModulePort(
                self.__dataInConnectionPoints[varName].module, self.__dataInConnectionPoints[varName].port
            )
            connect(ParentClass.dataConnectionPoint(self, varName), self.__dataInConnectionPoints[varName])

        # wenn voriges Modul tatsaechlich executed wurde, dann nicht mehr selbst executen
        if ParentClass.executeData(self, varName) == True:
            self.__needExecuteData[varName] = False
            return True

        if not self.__needExecuteData[varName]:
            return False
        self.__needExecuteData[varName] = False

        if varName in self.__dataInConnectionPoints.keys():
            saveExecute(self.__dataInConnectionPoints[varName].module)
            return True

        return False
Пример #41
0
    def __update(self, negMsgHandler):
        """ __update is called from the run method to update the module parameter before execution
            + do init
            + update module parameters """
        self.__init(negMsgHandler)

        PartModuleVis._update(self, negMsgHandler)
        if self.params.color==VARIABLE:
            PartColoredVis._update(self, negMsgHandler)
        self._setTransform()

        if not hasattr(self, 'importModule'):
            return

        #set color for variable
        if not self.__lastColorConnection==None:
            disconnect(self.__lastColorConnection, ConnectionPoint(self._module, 'DataIn0'))
            self.__lastColorConnection=None
        if self.__lastColorConnection==None and self.params.variable!=None \
            and self.params.variable!='Select a variable' and self.params.color == VARIABLE and len(self.objects)>0:
            _infoer.function = str(self.__update)
            _infoer.write("connection color for variable %s " % self.params.variable)
            self.__lastColorConnection =  (self.objects[0]).colorContConnectionPoint()
            connect(self.__lastColorConnection, ConnectionPoint(self._module, 'DataIn0'))
Пример #42
0
    def _initOct(self):
        self._initGeo()
        if self._oct == None:
            # create or use disk-cached octtrees
            if enableCachedOctTrees == True and self._dim == 3:
                basename, extension = os.path.splitext(self._part.filename)
                self._octTreeFileName = basename + ".octtree" + extension
                print("self._octTreeFileName = ", self._octTreeFileName)
                if os.path.isfile(self._octTreeFileName) == False:
                    # create disk-cached octtree
                    self._octTreeFileExists = False
                    self._oct = MakeOctTree()
                    theNet().add(self._oct)
                    self._octIn = ConnectionPoint(self._oct, 'inGrid')
                    self._octOut = ConnectionPoint(self._oct, 'outOctTree')
                    connect(self.geoConnectionPoint(), self._octIn)

                    # connect RWCovise to MakeOctTree
                    self._octTreeWriter = RWCovise()  # writable
                    theNet().add(self._octTreeWriter)
                    self._octTreeWriter.set_grid_path(self._octTreeFileName)
                    connect(self._octOut,
                            ConnectionPoint(self._octTreeWriter, 'mesh_in'))
                else:
                    # use disk-cached octtree
                    self._octTreeFileExists = True
                    self._oct = RWCovise()
                    theNet().add(self._oct)
                    self._oct.set_grid_path(self._octTreeFileName)
                    # cached octtrees must never get an input connection (RWCovise!)
                    self._octIn = None  # ConnectionPoint(self._oct, 'mesh_in')
                    self._octOut = ConnectionPoint(self._oct, 'mesh')
            else:
                self._oct = MakeOctTree()
                theNet().add(self._oct)
                self._octIn = ConnectionPoint(self._oct, 'inGrid')
                self._octOut = ConnectionPoint(self._oct, 'outOctTree')
                connect(self.geoConnectionPoint(), self._octIn)
        else:
            if enableCachedOctTrees == True and self._octTreeFileExists == True:
                # no reconnect necessary, if using disk-cached octtree
                pass
            else:
                # reconnect OctTree
                theNet().disconnectAllFromModulePort(self._oct, 'inGrid')
                connect(self.geoConnectionPoint(), self._octIn)
Пример #43
0
 def _initOct(self):
     self._initGeo()
     if self._oct==None:
         # create or use disk-cached octtrees
         if enableCachedOctTrees == True and self._dim == 3:
             basename, extension = os.path.splitext(self._part.filename)
             self._octTreeFileName = basename + ".octtree" + extension
             print("self._octTreeFileName = ", self._octTreeFileName)
             if os.path.isfile(self._octTreeFileName) == False:
                 # create disk-cached octtree
                 self._octTreeFileExists = False
                 self._oct = MakeOctTree()
                 theNet().add(self._oct)
                 self._octIn  = ConnectionPoint( self._oct, 'inGrid' )
                 self._octOut = ConnectionPoint( self._oct, 'outOctTree' )
                 connect( self.geoConnectionPoint(), self._octIn )
                 
                 # connect RWCovise to MakeOctTree
                 self._octTreeWriter = RWCovise()       # writable
                 theNet().add(self._octTreeWriter)
                 self._octTreeWriter.set_grid_path(self._octTreeFileName)
                 connect(self._octOut, ConnectionPoint(self._octTreeWriter, 'mesh_in'))
             else:
                 # use disk-cached octtree
                 self._octTreeFileExists = True
                 self._oct = RWCovise()
                 theNet().add(self._oct)
                 self._oct.set_grid_path(self._octTreeFileName)
                 # cached octtrees must never get an input connection (RWCovise!)
                 self._octIn = None # ConnectionPoint(self._oct, 'mesh_in')
                 self._octOut = ConnectionPoint(self._oct, 'mesh')
         else:
             self._oct = MakeOctTree()
             theNet().add(self._oct)
             self._octIn  = ConnectionPoint( self._oct, 'inGrid' )
             self._octOut = ConnectionPoint( self._oct, 'outOctTree' )
             connect( self.geoConnectionPoint(), self._octIn )
     else:
         if enableCachedOctTrees == True and self._octTreeFileExists == True:
             # no reconnect necessary, if using disk-cached octtree
             pass
         else:
             # reconnect OctTree
             theNet().disconnectAllFromModulePort(self._oct, 'inGrid')
             connect(self.geoConnectionPoint(), self._octIn)
Пример #44
0
    def _initSample( self, varname, outside ):
        if not (varname,outside) in self._sample:
            self._sample[(varname,outside)] = Sample()
            theNet().add(self._sample[(varname,outside)])
            self._bbox[(varname,USER_DEFINED)] = Box()
            self._bbox[(varname,MAX_FLT)] = Box()

#            connect( Import3DModule.geoConnectionPoint(self), ConnectionPoint(self._sample[(varname,outside)], 'GridIn') )
#            connect( Import3DModule.dataConnectionPoint(self, varname), ConnectionPoint(self._sample[(varname,outside)], 'DataIn') )
            connect( ParentClass3D.geoConnectionPoint(self), ConnectionPoint(self._sample[(varname,outside)], 'GridIn') )
            connect( ParentClass3D.dataConnectionPoint(self, varname), ConnectionPoint(self._sample[(varname,outside)], 'DataIn') )

            sample = self._sample[(varname,outside)]
            sample.set_outside(outside)
            if not ParentClass3D.executeOct(self) and not ParentClass3D.executeData(self, varname):
                saveExecute(sample)

        # reconnect Sample
#        print "RECONNECTING 3D SAMPLE"
        theNet().disconnectAllFromModulePort(self._sample[(varname,outside)], 'GridIn')
        theNet().disconnectAllFromModulePort(self._sample[(varname,outside)], 'DataIn')
        connect( ParentClass3D.geoConnectionPoint(self), ConnectionPoint(self._sample[(varname,outside)], 'GridIn') )
        connect( ParentClass3D.dataConnectionPoint(self, varname), ConnectionPoint(self._sample[(varname,outside)], 'DataIn') )
Пример #45
0
    def __init(self):
        """ start COVISE ReadCAD Module """
        if self.__readCad==None :
            self.__readCad = ReadCAD()
            theNet().add(self.__readCad)
            self.__readCadPolyOut = ConnectionPoint( self.__readCad, 'mesh' )
            self.__readCadNormalsOut = ConnectionPoint( self.__readCad, 'Normals' )
            self.__readCadColorsOut = ConnectionPoint( self.__readCad, 'colorOut' )
            self.__readCad.set_catia_server('obie')
            self.__readCad.set_catia_server_port('7000')
            self.__readCad.set_partIndex(self.__index)
            self.__readCad.set_file_path( self.__filename )

            self.__collect = Collect()
            theNet().add(self.__collect)
            connect( self.__readCadPolyOut, ConnectionPoint(self.__collect, 'GridIn0') )
            connect( self.__readCadNormalsOut, ConnectionPoint(self.__collect, 'DataIn1' ) )
            connect( self.__readCadColorsOut, ConnectionPoint(self.__collect, 'DataIn0' ) )
            self.__connectGeoOut =  ConnectionPoint(self.__collect, 'GeometryOut0' )
Пример #46
0
    def _initSample(self, varname=None, outside=USER_DEFINED):
        if self._sample==None:
            self._sample = Sample()
            theNet().add(self._sample)
#            connect( Import2DModule.geoConnectionPoint(self), ConnectionPoint(self._sample, 'GridIn') )
            connect( ParentClass2D.geoConnectionPoint(self), ConnectionPoint(self._sample, 'GridIn') )

            self._showgrid = ShowGrid()
            theNet().add(self._showgrid)
            connect( ConnectionPoint(self._sample, 'GridOut'), ConnectionPoint(self._showgrid, 'meshIn') )

            sample = self._sample
            if not ParentClass2D.executeOct(self) and not ParentClass2D.executeData(self, varname):
                saveExecute(sample)


        # reconnect Sample
#        print "RECONNECTING 2D SAMPLE"
        theNet().disconnectAllFromModulePort(self._sample, 'GridIn')
        connect( ParentClass2D.geoConnectionPoint(self), ConnectionPoint(self._sample, 'GridIn') )
Пример #47
0
    def setReductionFactor(self, rf, execute=True):
        self.__reductionFactor = rf

        if rf == 1 and self.__reduceSetModules == []:
            return
            
        if rf < 0:
            timesteps = self.getNumTimeSteps()
            self.__reductionFactor = timesteps / 2

        self.__needExecute = True

        # create new modules if necessary
        if self.__reduceSetModules == []:
            numNeededReduceSetModules = 1
            numConnectedVariables = 1   # 1, so data variable connecting will start at port 'input_1' ('input_0' is geometry)

            # create initial module
            self.__reduceSetModules.append(ReduceSetModule())

            # connect geometry
            connect( ParentClass.geoConnectionPoint(self), self.__reduceSetModules[0].geoInConnectionPoint() )

            # connect data
            for name in self._dataFileNames:

                # TODO: should be made unnecessary
                self.executeData(name)
                
                portNum = numConnectedVariables % 8
                if len(self.__reduceSetModules) < numNeededReduceSetModules:
                    self.__reduceSetModules.append(ReduceSetModule())

#                theNet().disconnectAllFromModulePort(ParentClass.dataConnectionPoint(self, name).module, ParentClass.dataConnectionPoint(self, name).port)
                if portNum == 0:
                    self.__dataConnectionPoints[name] = self.__reduceSetModules[numNeededReduceSetModules-1].data0OutConnectionPoint()
                    connect(ParentClass.dataConnectionPoint(self, name), self.__reduceSetModules[numNeededReduceSetModules-1].data0InConnectionPoint())
                elif portNum == 1:
                    self.__dataConnectionPoints[name] = self.__reduceSetModules[numNeededReduceSetModules-1].data1OutConnectionPoint()
                    connect(ParentClass.dataConnectionPoint(self, name), self.__reduceSetModules[numNeededReduceSetModules-1].data1InConnectionPoint())
                elif portNum == 2:
                    self.__dataConnectionPoints[name] = self.__reduceSetModules[numNeededReduceSetModules-1].data2OutConnectionPoint()
                    connect(ParentClass.dataConnectionPoint(self, name), self.__reduceSetModules[numNeededReduceSetModules-1].data2InConnectionPoint())
                elif portNum == 3:
                    self.__dataConnectionPoints[name] = self.__reduceSetModules[numNeededReduceSetModules-1].data3OutConnectionPoint()
                    connect(ParentClass.dataConnectionPoint(self, name), self.__reduceSetModules[numNeededReduceSetModules-1].data3InConnectionPoint())
                elif portNum == 4:
                    self.__dataConnectionPoints[name] = self.__reduceSetModules[numNeededReduceSetModules-1].data4OutConnectionPoint()
                    connect(ParentClass.dataConnectionPoint(self, name), self.__reduceSetModules[numNeededReduceSetModules-1].data4InConnectionPoint())
                elif portNum == 5:
                    self.__dataConnectionPoints[name] = self.__reduceSetModules[numNeededReduceSetModules-1].data5OutConnectionPoint()
                    connect(ParentClass.dataConnectionPoint(self, name), self.__reduceSetModules[numNeededReduceSetModules-1].data5InConnectionPoint())
                elif portNum == 6:
                    self.__dataConnectionPoints[name] = self.__reduceSetModules[numNeededReduceSetModules-1].data6OutConnectionPoint()
                    connect(ParentClass.dataConnectionPoint(self, name), self.__reduceSetModules[numNeededReduceSetModules-1].data6InConnectionPoint())
                elif portNum == 7:
                    self.__dataConnectionPoints[name] = self.__reduceSetModules[numNeededReduceSetModules-1].data7OutConnectionPoint()
                    connect(ParentClass.dataConnectionPoint(self, name), self.__reduceSetModules[numNeededReduceSetModules-1].data7InConnectionPoint())

                numConnectedVariables = numConnectedVariables + 1
                if numConnectedVariables % 8 == 0:
                    numNeededReduceSetModules = numNeededReduceSetModules + 1
            
        for rS in self.__reduceSetModules:
            rS.setReductionFactor(self.__reductionFactor)

        if execute:
            for rS in self.__reduceSetModules:
                rS.execute()
            self.__needExecute = False
            return True
        return False
Пример #48
0
    def setTranslation(self, x,y,z, execute=True):
        self.__transX = x
        self.__transY = y
        self.__transZ = z

        # create new module if necessary
        if self.__translation == None:
            self.__translation = TransformModule()
            if self.__rotation == None:
                connect(self.iGroupModule.geoConnectionPoint(), self.__translation.geoInConnectionPoint())
            else:
                connect(self.__rotation.geoOutConnectionPoint(), self.__translation.geoInConnectionPoint())
                connect(self.__rotation.data0OutConnectionPoint(), self.__translation.data0InConnectionPoint())
                connect(self.__rotation.data1OutConnectionPoint(), self.__translation.data1InConnectionPoint())
                connect(self.__rotation.data2OutConnectionPoint(), self.__translation.data2InConnectionPoint())
                connect(self.__rotation.data3OutConnectionPoint(), self.__translation.data3InConnectionPoint())

        self.__translation.setTranslation(self.__transX, self.__transY, self.__transZ)
        if execute:
            r.execute()
            return True
        return False
Пример #49
0
 def dataConnectionPoint(self, varname):
     if not varname in self._assembleUsg:
         self._initAssemble(varname)
         connect( ImportGroupModule.geoConnectionPoint(self), self._assembleUsg[varname].geoInConnectionPoint() )
         connect( ImportGroupModule.dataConnectionPoint(self,varname), self._assembleUsg[varname].dataInConnectionPoint() )
     return  self._assembleUsg[varname].dataOutConnectionPoint()
Пример #50
0
 def octConnectionPoint( self ):
     self._initOct()
     self._octOut = ConnectionPoint( self._oct, 'outOctTree' )
     connect( self.geoConnectionPoint(), ConnectionPoint( self._oct, 'inGrid' ) )
     return self._octOut
Пример #51
0
    def __initData(self, varName):
        if not varName in self.__needExecuteData.keys():
            self.__needExecuteData[varName] = False

        if self.__rotAngle == 0 and self.__rotations == []:
            pass
        else:
            if (self._dataVariableType[varName] != SCALARVARIABLE) and (
                    not varName in self.__dataInConnectionPoints.keys()) and (
                        self.__rotAngle != 0):

                portNum = self.__numConnectedVectorVariables % 4
                if len(self.__rotations) < self.__numNeededRotationModules:
                    self.__rotations.append(TransformModule())
                    self.__rotations[self.__numNeededRotationModules -
                                     1].setRotation(self.__rotAngle,
                                                    self.__rotX, self.__rotY,
                                                    self.__rotZ)
                    self.__needExecuteData[varName] = True
                    # verbinde notwendige geometrie
                    connect(
                        ParentClass.geoConnectionPoint(self),
                        self.__rotations[self.__numNeededRotationModules -
                                         1].geoInConnectionPoint())

                if portNum == 0:
                    self.__dataConnectionPoints[varName] = self.__rotations[
                        self.__numNeededRotationModules -
                        1].data0OutConnectionPoint()
                    self.__dataInConnectionPoints[varName] = self.__rotations[
                        self.__numNeededRotationModules -
                        1].data0InConnectionPoint()
                elif portNum == 1:
                    self.__dataConnectionPoints[varName] = self.__rotations[
                        self.__numNeededRotationModules -
                        1].data1OutConnectionPoint()
                    self.__dataInConnectionPoints[varName] = self.__rotations[
                        self.__numNeededRotationModules -
                        1].data1InConnectionPoint()
                elif portNum == 2:
                    self.__dataConnectionPoints[varName] = self.__rotations[
                        self.__numNeededRotationModules -
                        1].data2OutConnectionPoint()
                    self.__dataInConnectionPoints[varName] = self.__rotations[
                        self.__numNeededRotationModules -
                        1].data2InConnectionPoint()
                elif portNum == 3:
                    self.__dataConnectionPoints[varName] = self.__rotations[
                        self.__numNeededRotationModules -
                        1].data3OutConnectionPoint()
                    self.__dataInConnectionPoints[varName] = self.__rotations[
                        self.__numNeededRotationModules -
                        1].data3InConnectionPoint()

                self.__numConnectedVectorVariables = self.__numConnectedVectorVariables + 1
                if self.__numConnectedVectorVariables % 4 == 0:
                    self.__numNeededRotationModules = self.__numNeededRotationModules + 1

                if self.__translation == None:
                    pass
                else:
                    theNet().disconnectAllFromModulePort(
                        self.__translation.geoInConnectionPoint().module,
                        self.__translation.geoInConnectionPoint().port)
                    connect(self.__rotations[0].geoOutConnectionPoint(),
                            self.__translation.geoInConnectionPoint())
Пример #52
0
    def _init(self, negMsgHandler, sampleType=None):
        '''called from _update
            if module exists connect output of it to COVER
        '''
        if not sampleType == None:
            self._sampleType = sampleType
        if self._module == None and hasattr(
                self, 'importModule') and self.__firstTime:
            self.__firstTime = False
            self._module = self._moduleName()
            theNet().add(self._module)
            # need to execute blockcollect for geo
            if type(self.importModule
                    ) == ImportGroupManager.ImportGroup3DModule:
                self.importModule.executeGeo()

            for geoInput in self._geoInputNames:
                connect(self.importModule.geoConnectionPoint(),
                        ConnectionPoint(self._module, geoInput))

            if self.__createOcttree:
                if len(self._octtreeInputNames) > 0:
                    for octtree in self._octtreeInputNames:
                        connect(self.importModule.octTreeConnectionPoint(),
                                ConnectionPoint(self._module, octtree))
                    self.importModule.executeOct()

            if (len(self._dataInputNames) > 0):
                if hasattr(
                        self.params, 'variable'
                ) and self.params.variable and self.params.variable != 'Select a variable' and self.params.variable != 'unset':
                    for dataInput in self._dataInputNames:
                        connect(
                            self.importModule.dataConnectionPoint(
                                self.params.variable),
                            ConnectionPoint(self._module, dataInput))

            if len(self._geoSampleNames
                   ) > 0 and not self.importModule.getIsTransient():
                if hasattr(
                        self.params, 'variable'
                ) and self.params.variable and self.params.variable != 'Select a variable' and self.params.variable != 'unset':
                    assert self.params.variable != 'Select a variable'
                    self.importModule.executeSampleData(
                        self.params.variable, None, self._sampleType)
                    for geoSample in self._geoSampleNames:
                        connect(
                            self.importModule.geoSampleConnectionPoint(
                                self.params.variable, self._sampleType),
                            ConnectionPoint(self._module, geoSample))

            if len(self._dataSampleNames
                   ) > 0 and not self.importModule.getIsTransient():
                if hasattr(
                        self.params, 'variable'
                ) and self.params.variable and self.params.variable != 'Select a variable' and self.params.variable != 'unset':
                    assert self.params.variable != 'Select a variable'
                    for dataSample in self._dataSampleNames:
                        connect(
                            self.importModule.dataSampleConnectionPoint(
                                self.params.variable, self._sampleType),
                            ConnectionPoint(self._module, dataSample))
            self.reloadBBox()

            # optionally connect to COVER
            if not covise.coConfigIsOn("vr-prepare.InvisibleConnectToRenderer",
                                       True):
                # only connect to COVER if this visualizer really is visible
                if self.params.isVisible and not self.__connectedToCOVER:
                    VisItem.connectToCover(self, self)
                    self.__connectedToCOVER = True
            else:
                VisItem.connectToCover(self, self)
                self.__connectedToCOVER = True

        # refresh all connections as they might have changed
        if self._module != None and hasattr(self, 'importModule'):

            for geoInput in self._geoInputNames:
                theNet().disconnectAllFromModulePort(
                    self._module,
                    geoInput)  # remove all connections at the inport
                connect(self.importModule.geoConnectionPoint(),
                        ConnectionPoint(self._module, geoInput))

            if self.__createOcttree:
                for octtree in self._octtreeInputNames:
                    theNet().disconnectAllFromModulePort(
                        self._module,
                        octtree)  # remove all connections at the inport
                    connect(self.importModule.octTreeConnectionPoint(),
                            ConnectionPoint(self._module, octtree))

            if (len(self._dataInputNames) > 0):
                if hasattr(
                        self.params, 'variable'
                ) and self.params.variable and self.params.variable != 'Select a variable' and self.params.variable != 'unset':
                    for dataInput in self._dataInputNames:
                        theNet().disconnectAllFromModulePort(
                            self._module, dataInput)
                        connect(
                            self.importModule.dataConnectionPoint(
                                self.params.variable),
                            ConnectionPoint(self._module, dataInput))

            if hasattr(
                    self.params, 'variable'
            ) and self.params.variable and self.params.variable != 'Select a variable' and self.params.variable != 'unset':
                if self.params.variable != 'Select a variable' and not self.importModule.getIsTransient(
                ):
                    for geoSample in self._geoSampleNames:
                        theNet().disconnectAllFromModulePort(
                            self._module, geoSample)
                        connect(
                            self.importModule.geoSampleConnectionPoint(
                                self.params.variable, self._sampleType),
                            ConnectionPoint(self._module, geoSample))

            if hasattr(
                    self.params, 'variable'
            ) and self.params.variable and self.params.variable != 'Select a variable' and self.params.variable != 'unset':
                if self.params.variable != 'Select a variable' and not self.importModule.getIsTransient(
                ):
                    for dataSample in self._dataSampleNames:
                        theNet().disconnectAllFromModulePort(
                            self._module, dataSample)
                        connect(
                            self.importModule.dataSampleConnectionPoint(
                                self.params.variable, self._sampleType),
                            ConnectionPoint(self._module, dataSample))

            self.reloadBBox()

            # connect to COVER if visible and wasnt done initially
            if self.params.isVisible and not self.__connectedToCOVER:
                VisItem.connectToCover(self, self)
                self.__connectedToCOVER = True
Пример #53
0
 def octConnectionPoint(self):
     self._initOct()
     self._octOut = ConnectionPoint(self._oct, 'outOctTree')
     connect(self.geoConnectionPoint(),
             ConnectionPoint(self._oct, 'inGrid'))
     return self._octOut