Exemplo n.º 1
0
    def __update(self, negMsgHandler):
        """ __update is called from the run method to update the module parameter before execution
            + do init if the cutting surface module if necessary
            + update module parameters """
        self.__init(negMsgHandler)
        PartModuleVis._update(self, negMsgHandler)
        PartColoredVis._update(self, negMsgHandler)
        PartInteractorVis._update(self, negMsgHandler)

        # other parameters
        aRectangleIn3d1Mid1Norm = convertAlignedRectangleToCutRectangle(
            self.params.alignedRectangle)
        self._module.set_point(*aRectangleIn3d1Mid1Norm.point)
        self._module.set_vertex(*aRectangleIn3d1Mid1Norm.normal)
        self._module.set_option(1)
        self._module.set_vector(self.params.vector)
        if 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 arrows
        if hasattr(self.params, 'length'):
            self._module.set_length(self.params.length)
        if hasattr(self.params, 'scale'):
            self._module.set_scale(0.0, 1.0, self.params.scale)
            self._module.set_num_sectors(3)
        if hasattr(self.params, 'arrow_head_factor'):
            self._module.set_arrow_head_factor(self.params.arrow_head_factor)
        if hasattr(self.params, 'project_arrows'):
            self._module.set_project_lines(str(self.params.project_arrows))
Exemplo 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 cutting surface module if necessary
            + update module parameters """
        self.__init(negMsgHandler)
        PartModuleVis._update(self, negMsgHandler)
        PartColoredVis._update(self, negMsgHandler)
        PartInteractorVis._update(self, negMsgHandler)
        
        # other parameters
        aRectangleIn3d1Mid1Norm = convertAlignedRectangleToCutRectangle( self.params.alignedRectangle)
        self._module.set_point(*aRectangleIn3d1Mid1Norm.point)
        self._module.set_vertex(*aRectangleIn3d1Mid1Norm.normal)
        self._module.set_option(1)
        self._module.set_vector(self.params.vector)
        if 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 arrows
        if hasattr(self.params, 'length'): self._module.set_length(self.params.length)
        if hasattr(self.params, 'scale'):
            self._module.set_scale(0.0, 1.0, self.params.scale)
            self._module.set_num_sectors(3)
        if hasattr(self.params, 'arrow_head_factor'): self._module.set_arrow_head_factor(self.params.arrow_head_factor)
        if hasattr(self.params, 'project_arrows'): self._module.set_project_lines(str(self.params.project_arrows))
Exemplo 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")
Exemplo n.º 4
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")
Exemplo n.º 5
0
 def __update(self):
     rect = convertAlignedRectangleToCutRectangle(self.params.alignedRectangle)
     self.cut.setNormal( *rect.getNormal() )
     self.cut.setDistance( rect.getDistance() )
Exemplo n.º 6
0
 def __update(self):
     rect = convertAlignedRectangleToCutRectangle(
         self.params.alignedRectangle)
     self.cut.setNormal(*rect.getNormal())
     self.cut.setDistance(rect.getDistance())