Esempio n. 1
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()
Esempio n. 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()
Esempio n. 3
0
def suite():
    def loadTests(testCaseClass):
        return unittest.defaultTestLoader.loadTestsFromTestCase(testCaseClass)

    # Create Renderer (Use VRPCoviseNetAccess._globalRenderer, so saveExecute works correctly)
    globalRenderer()
    # Use the same Renderer for all tests!
    # There seems to be a problem when creating and deleting a Renderer for each test individually.
    # If the Renderer is deleted immediatelly after the test, the finishedBarrier doesn't work anymore.
    # (Maybe that's because the Renderer is still receiving geometry while it's beeing removed.)

    testSuite = unittest.TestSuite()
    testSuite.addTests(loadTests(ImportModuleTestCase))

    return testSuite
Esempio n. 4
0
def suite():
    def loadTests(testCaseClass):
        return unittest.defaultTestLoader.loadTestsFromTestCase(testCaseClass)

    # Create Renderer (Use VRPCoviseNetAccess._globalRenderer, so saveExecute works correctly)
    globalRenderer()
    # Use the same Renderer for all tests!
    # There seems to be a problem when creating and deleting a Renderer for each test individually.
    # If the Renderer is deleted immediatelly after the test, the finishedBarrier doesn't work anymore.
    # (Maybe that's because the Renderer is still receiving geometry while it's beeing removed.)

    testSuite = unittest.TestSuite()
    testSuite.addTests(loadTests(ImportModuleTestCase))

    return testSuite
Esempio n. 5
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)
Esempio n. 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)
Esempio n. 7
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() )
Esempio n. 8
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())
Esempio n. 9
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)
Esempio n. 10
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)
Esempio n. 11
0
 def disconnectFromCover(self, visConnectionModule):
     coverModule = globalRenderer().connectionPoint().module
     visItemModule = visConnectionModule.connectionPoint().module
     theNet().disconnectModuleModule(coverModule, visItemModule)
Esempio n. 12
0
 def disconnectFromCover(self, visConnectionModule):
     coverModule = globalRenderer().connectionPoint().module
     visItemModule = visConnectionModule.connectionPoint().module
     theNet().disconnectModuleModule(coverModule, visItemModule)