Exemplo n.º 1
0
    def _drawHandles(self):
        """
        Draw the handles for the command.struct
        """
        if 0:  #self.command and self.command.hasValidStructure():
            for handle in self.command.handles:
                handle.draw()

        if self.command and self.command.hasValidStructure():
            for handle in self.command.handles:
                if handle.hasValidParamsForDrawing():
                    handle.draw()

        handleType = ''
        if self.command.grabbedHandle is not None:
            if self.command.grabbedHandle in [
                    self.command.rotationHandle1, self.command.rotationHandle2
            ]:
                handleType = 'ROTATION_HANDLE'
            else:
                handleType = 'RESIZE_HANDLE'

        # self.command.struct is (temporarily?) None after a nanotube segment
        # has been resized. This causes a trackback. This seems to fix it.
        # --Mark 2008-04-01
        if not self.command.struct:
            return

        if handleType and handleType == 'RESIZE_HANDLE':

            #use self.glpane.displayMode for rubberbandline displayMode
            drawNanotubeLadder(
                self.command.grabbedHandle.fixedEndOfStructure,
                self.command.grabbedHandle.currentPosition,
                self.command.struct.nanotube.getRise(),
                self.glpane.scale,
                self.glpane.lineOfSight,
                ladderWidth=self.command.struct.nanotube.getDiameter(),
                beamThickness=4.0,
                beam1Color=gray,
                beam2Color=gray,
            )

            self._drawCursorText()
        else:
            #No handle is grabbed. But may be the structure changed
            #(e.g. while dragging it ) and as a result, the endPoint positions
            #are modified. So we must update the handle positions because
            #during left drag (when handle is not dragged) we skip the
            #handle drawing code and computation to update the handle positions
            #TODO: see bug 2729 for planned optimization
            self.command.updateHandlePositions()
        return
    def _drawHandles(self):
        """
        Draw the handles for the command.struct
        """
        if 0: #self.command and self.command.hasValidStructure():
            for handle in self.command.handles:
                handle.draw()

        if self.command and self.command.hasValidStructure():
            for handle in self.command.handles:
                if handle.hasValidParamsForDrawing():
                    handle.draw()

        handleType = ''
        if self.command.grabbedHandle is not None:
            if self.command.grabbedHandle in [self.command.rotationHandle1,
                                              self.command.rotationHandle2]:
                handleType = 'ROTATION_HANDLE'
            else:
                handleType = 'RESIZE_HANDLE'

        # self.command.struct is (temporarily?) None after a nanotube segment
        # has been resized. This causes a trackback. This seems to fix it.
        # --Mark 2008-04-01
        if not self.command.struct:
            return

        if handleType and handleType == 'RESIZE_HANDLE':

            #use self.glpane.displayMode for rubberbandline displayMode
            drawNanotubeLadder(self.command.grabbedHandle.fixedEndOfStructure,
                          self.command.grabbedHandle.currentPosition,
                          self.command.struct.nanotube.getRise(),
                          self.glpane.scale,
                          self.glpane.lineOfSight,
                          ladderWidth = self.command.struct.nanotube.getDiameter(),
                          beamThickness = 4.0,
                          beam1Color = gray,
                          beam2Color = gray,
                          )

            self._drawCursorText()
        else:
            #No handle is grabbed. But may be the structure changed
            #(e.g. while dragging it ) and as a result, the endPoint positions
            #are modified. So we must update the handle positions because
            #during left drag (when handle is not dragged) we skip the
            #handle drawing code and computation to update the handle positions
            #TODO: see bug 2729 for planned optimization
            self.command.updateHandlePositions()
        return
Exemplo n.º 3
0
 def Draw_other(self):
     """
     Draw the Nanotube rubberband line (a ladder representation)
     """
     _superclass_for_GM.Draw_other(self)
     if self.endPoint2 is not None and \
        self.endPoint1 is not None:
         
         # Draw the ladder.
         drawNanotubeLadder(
             self.endPoint1,
             self.endPoint2, 
             self.command.nanotube.getRise(),
             self.glpane.scale,
             self.glpane.lineOfSight,
             ladderWidth = self.command.nanotube.getDiameter(),
             beamThickness = 4.0,
          )
     return
Exemplo n.º 4
0
    def Draw_other(self):
        """
        Draw the Nanotube rubberband line (a ladder representation)
        """
        _superclass_for_GM.Draw_other(self)
        if self.endPoint2 is not None and \
           self.endPoint1 is not None:

            # Draw the ladder.
            drawNanotubeLadder(
                self.endPoint1,
                self.endPoint2,
                self.command.nanotube.getRise(),
                self.glpane.scale,
                self.glpane.lineOfSight,
                ladderWidth=self.command.nanotube.getDiameter(),
                beamThickness=4.0,
            )
        return