Ejemplo n.º 1
0
    def sendInteractor(self):
        """ send interactor geometry to cover """
        _infoer.function = str(self.sendInteractor)
        _infoer.write("")

        if self.keyRegistered():
            _infoer.function = str(self.sendInteractor)
            _infoer.write("sendInteractor for key %s in mode %s" % ( self.covise_key, self.__format ) )
            if self.__format==TRACER:
                if self.params.alignedRectangle.orthogonalAxis == 'line':
                    rec = convertAlignedRectangleToGeneral( self.params.alignedRectangle )
                    startPoint = self.params.alignedRectangle.getStartPoint()
                    msg = coGRObjMoveInterMsg( coGRMsg.MOVE_INTERACTOR, self.covise_key, "s1", startPoint[0], startPoint[1], startPoint[2] )
                    covise.sendRendMsg(msg.c_str())
                    endPoint = self.params.alignedRectangle.getEndPoint()
                    msg = coGRObjMoveInterMsg( coGRMsg.MOVE_INTERACTOR, self.covise_key, "s2", endPoint[0], endPoint[1], endPoint[2] )
                    covise.sendRendMsg(msg.c_str())
                    msg = coGRObjMoveInterMsg( coGRMsg.MOVE_INTERACTOR,self.covise_key, "direction", rec.direction[0], rec.direction[1], rec.direction[2] )
                    covise.sendRendMsg(msg.c_str())
                else:
                    rec = convertAlignedRectangleToGeneral( self.params.alignedRectangle )
                    msg = coGRObjMoveInterMsg( coGRMsg.MOVE_INTERACTOR, self.covise_key, "s1", rec.pointA[0], rec.pointA[1], rec.pointA[2] )
                    covise.sendRendMsg(msg.c_str())
                    msg = coGRObjMoveInterMsg( coGRMsg.MOVE_INTERACTOR,self.covise_key, "s2", rec.pointC[0], rec.pointC[1], rec.pointC[2] )
                    covise.sendRendMsg(msg.c_str())
                    msg = coGRObjMoveInterMsg( coGRMsg.MOVE_INTERACTOR,self.covise_key, "direction", rec.direction[0], rec.direction[1], rec.direction[2] )
                    covise.sendRendMsg(msg.c_str())
            elif self.__format==CUT:
                rec = convertAlignedRectangleToCutRectangle( self.params.alignedRectangle )
                msg = coGRObjMoveInterMsg( coGRMsg.MOVE_INTERACTOR,self.covise_key, "normal", rec.normal[0], rec.normal[1], rec.normal[2] )
                covise.sendRendMsg(msg.c_str())
                msg = coGRObjMoveInterMsg( coGRMsg.MOVE_INTERACTOR, self.covise_key, "point", rec.point[0], rec.point[1], rec.point[2] )
                covise.sendRendMsg(msg.c_str())
            else:
                print("unknown format")
Ejemplo n.º 2
0
    def __update(self, negMsgHandler):
        """ __update is called from the run method to update the module parameter before execution
            + do init if the tracer module if necessary
            + update module parameters """
        self.__init(negMsgHandler)
        PartModuleVis._update(self, negMsgHandler)
        PartColoredVis._update(self, negMsgHandler)
        PartInteractorVis._update(self, negMsgHandler)

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

        #update params
        # no of starting points
        if self.params.no_startp<12:
            min_start = 1
            max_start = 20
        elif self.params.no_startp<100:
            min_start = 1
            max_start = 2*self.params.no_startp
        else:
            min_start = 0.5 * self.params.no_startp
            max_start = 4 * self.params.no_startp
        self._module.set_no_startp( min_start, max_start, self.params.no_startp )
        # other parameters
        if self.params.alignedRectangle.orthogonalAxis=='line':
            s0 = self.params.alignedRectangle.getStartPoint()
            s1 = self.params.alignedRectangle.getEndPoint()
            self._module.set_startpoint1(s0[0], s0[1], s0[2] )
            self._module.set_startpoint2(s1[0], s1[1], s1[2] )
        else :
            aRectangleIn3d2Ps1Dir = convertAlignedRectangleToGeneral( self.params.alignedRectangle)
            self._module.set_startpoint1(*aRectangleIn3d2Ps1Dir.pointA)
            self._module.set_startpoint2(*aRectangleIn3d2Ps1Dir.pointC)
            self._module.set_direction(*aRectangleIn3d2Ps1Dir.direction)
        self._module.set_trace_len(self.params.len)
        self._module.set_trace_eps(self.params.eps)
        self._module.set_trace_abs(self.params.abs)
        self._module.set_min_vel(self.params.min_vel)
        self._module.set_tdirection(self.params.direction)
        self._module.set_grid_tol(self.params.grid_tol)
        self._module.set_maxOutOfDomain(self.params.maxOutOfDomain)

        if PartColoredVis.currentVariable(self) and PartColoredVis.currentVariable(self) in self.params.colorTableKey and globalKeyHandler().getObject(self.params.colorTableKey[self.currentVariable()]).params.mode==coColorTableParams.LOCAL :
            self._module.set_autoScales('TRUE')
        else :
            self._module.set_autoScales('FALSE')

        self._module.setTitle( self.params.name )
        # init params in case of moving points or pathlines
        if hasattr(self.params, 'duration' ):     self._module.set_stepDuration(self.params.duration)
        if hasattr(self.params, 'sphereRadius' ): self._module.set_SphereRadius(self.params.sphereRadius)
        if hasattr(self.params, 'tubeWidth' ): self._module.set_TubeWidth(self.params.tubeWidth)
        if hasattr(self.params, 'numSteps' ): self._module.set_MaxPoints(self.params.numSteps)
        if hasattr(self.params, 'start_style'): self._module.set_startStyle(self.params.start_style)
        if hasattr(self.params, 'freeStartPoints'): 
            if self.params.freeStartPoints == '':
                if hasattr(self, 'oldFreeStartPoints'):
                    self.params.freeStartPoints = self.oldFreeStartPoints
            self._module.set_FreeStartPoints(self.params.freeStartPoints)
Ejemplo n.º 3
0
    def sendInteractor(self):
        """ send interactor geometry to cover """
        _infoer.function = str(self.sendInteractor)
        _infoer.write("")

        if self.keyRegistered():
            _infoer.function = str(self.sendInteractor)
            _infoer.write("sendInteractor for key %s in mode %s" %
                          (self.covise_key, self.__format))
            if self.__format == TRACER:
                if self.params.alignedRectangle.orthogonalAxis == 'line':
                    rec = convertAlignedRectangleToGeneral(
                        self.params.alignedRectangle)
                    startPoint = self.params.alignedRectangle.getStartPoint()
                    msg = coGRObjMoveInterMsg(coGRMsg.MOVE_INTERACTOR,
                                              self.covise_key, "s1",
                                              startPoint[0], startPoint[1],
                                              startPoint[2])
                    covise.sendRendMsg(msg.c_str())
                    endPoint = self.params.alignedRectangle.getEndPoint()
                    msg = coGRObjMoveInterMsg(coGRMsg.MOVE_INTERACTOR,
                                              self.covise_key, "s2",
                                              endPoint[0], endPoint[1],
                                              endPoint[2])
                    covise.sendRendMsg(msg.c_str())
                    msg = coGRObjMoveInterMsg(coGRMsg.MOVE_INTERACTOR,
                                              self.covise_key, "direction",
                                              rec.direction[0],
                                              rec.direction[1],
                                              rec.direction[2])
                    covise.sendRendMsg(msg.c_str())
                else:
                    rec = convertAlignedRectangleToGeneral(
                        self.params.alignedRectangle)
                    msg = coGRObjMoveInterMsg(coGRMsg.MOVE_INTERACTOR,
                                              self.covise_key, "s1",
                                              rec.pointA[0], rec.pointA[1],
                                              rec.pointA[2])
                    covise.sendRendMsg(msg.c_str())
                    msg = coGRObjMoveInterMsg(coGRMsg.MOVE_INTERACTOR,
                                              self.covise_key, "s2",
                                              rec.pointC[0], rec.pointC[1],
                                              rec.pointC[2])
                    covise.sendRendMsg(msg.c_str())
                    msg = coGRObjMoveInterMsg(coGRMsg.MOVE_INTERACTOR,
                                              self.covise_key, "direction",
                                              rec.direction[0],
                                              rec.direction[1],
                                              rec.direction[2])
                    covise.sendRendMsg(msg.c_str())
            elif self.__format == CUT:
                rec = convertAlignedRectangleToCutRectangle(
                    self.params.alignedRectangle)
                msg = coGRObjMoveInterMsg(coGRMsg.MOVE_INTERACTOR,
                                          self.covise_key, "normal",
                                          rec.normal[0], rec.normal[1],
                                          rec.normal[2])
                covise.sendRendMsg(msg.c_str())
                msg = coGRObjMoveInterMsg(coGRMsg.MOVE_INTERACTOR,
                                          self.covise_key, "point",
                                          rec.point[0], rec.point[1],
                                          rec.point[2])
                covise.sendRendMsg(msg.c_str())
            else:
                print("unknown format")
Ejemplo n.º 4
0
    def __update(self, negMsgHandler):
        """ __update is called from the run method to update the module parameter before execution
            + do init if the tracer module if necessary
            + update module parameters """
        self.__init(negMsgHandler)
        PartModuleVis._update(self, negMsgHandler)
        PartColoredVis._update(self, negMsgHandler)
        PartInteractorVis._update(self, negMsgHandler)

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

        #update params
        # no of starting points
        if self.params.no_startp < 12:
            min_start = 1
            max_start = 20
        elif self.params.no_startp < 100:
            min_start = 1
            max_start = 2 * self.params.no_startp
        else:
            min_start = 0.5 * self.params.no_startp
            max_start = 4 * self.params.no_startp
        self._module.set_no_startp(min_start, max_start, self.params.no_startp)
        # other parameters
        if self.params.alignedRectangle.orthogonalAxis == 'line':
            s0 = self.params.alignedRectangle.getStartPoint()
            s1 = self.params.alignedRectangle.getEndPoint()
            self._module.set_startpoint1(s0[0], s0[1], s0[2])
            self._module.set_startpoint2(s1[0], s1[1], s1[2])
        else:
            aRectangleIn3d2Ps1Dir = convertAlignedRectangleToGeneral(
                self.params.alignedRectangle)
            self._module.set_startpoint1(*aRectangleIn3d2Ps1Dir.pointA)
            self._module.set_startpoint2(*aRectangleIn3d2Ps1Dir.pointC)
            self._module.set_direction(*aRectangleIn3d2Ps1Dir.direction)
        self._module.set_trace_len(self.params.len)
        self._module.set_trace_eps(self.params.eps)
        self._module.set_trace_abs(self.params.abs)
        self._module.set_min_vel(self.params.min_vel)
        self._module.set_tdirection(self.params.direction)
        self._module.set_grid_tol(self.params.grid_tol)
        self._module.set_maxOutOfDomain(self.params.maxOutOfDomain)

        if PartColoredVis.currentVariable(
                self) and PartColoredVis.currentVariable(
                    self) in self.params.colorTableKey and globalKeyHandler(
                    ).getObject(self.params.colorTableKey[self.currentVariable(
                    )]).params.mode == coColorTableParams.LOCAL:
            self._module.set_autoScales('TRUE')
        else:
            self._module.set_autoScales('FALSE')

        self._module.setTitle(self.params.name)
        # init params in case of moving points or pathlines
        if hasattr(self.params, 'duration'):
            self._module.set_stepDuration(self.params.duration)
        if hasattr(self.params, 'sphereRadius'):
            self._module.set_SphereRadius(self.params.sphereRadius)
        if hasattr(self.params, 'tubeWidth'):
            self._module.set_TubeWidth(self.params.tubeWidth)
        if hasattr(self.params, 'numSteps'):
            self._module.set_MaxPoints(self.params.numSteps)
        if hasattr(self.params, 'start_style'):
            self._module.set_startStyle(self.params.start_style)
        if hasattr(self.params, 'freeStartPoints'):
            if self.params.freeStartPoints == '':
                if hasattr(self, 'oldFreeStartPoints'):
                    self.params.freeStartPoints = self.oldFreeStartPoints
            self._module.set_FreeStartPoints(self.params.freeStartPoints)