コード例 #1
0
    def _draw_jig(self, glpane, color, highlighted=False):
        """
        Draw a ESP Image jig as a plane with an edge and a bounding box.
        """
        glPushMatrix()

        glTranslatef(self.center[0], self.center[1], self.center[2])
        q = self.quat
        glRotatef(q.angle * 180.0 / math.pi, q.x, q.y, q.z)

        #bruce 060207 extensively revised texture code re fixing bug 1059
        if self.tex_name is not None and self.image_obj:  # self.image_obj condition is needed, for clear_esp_image() to work
            textureReady = True
            glBindTexture(
                GL_TEXTURE_2D, self.tex_name
            )  # maybe this belongs in draw_plane instead? Put it there later. ##e
            self._initTextureEnv()  # sets texture params the way we want them
        else:
            textureReady = False
        drawPlane(self.fill_color,
                  self.width,
                  self.width,
                  textureReady,
                  self.opacity,
                  SOLID=True,
                  pickCheckOnly=self.pickCheckOnly)

        hw = self.width / 2.0
        corners_pos = [
            V(-hw, hw, 0.0),
            V(-hw, -hw, 0.0),
            V(hw, -hw, 0.0),
            V(hw, hw, 0.0)
        ]
        drawLineLoop(color, corners_pos)

        # Draw the ESP Image bbox.
        if self.show_esp_bbox:
            wo = self.image_offset
            eo = self.edge_offset
            drawwirecube(color, V(0.0, 0.0, 0.0), V(hw + eo, hw + eo, wo),
                         1.0)  #drawwirebox

            # This is for debugging purposes.  This draws a green normal vector using
            # local space coords.  Mark 050930
            if 0:
                from graphics.drawing.CS_draw_primitives import drawline
                drawline(green, V(0.0, 0.0, 0.0), V(0.0, 0.0, 1.0), 0, 3)

        glPopMatrix()

        # This is for debugging purposes. This draws a yellow normal vector using
        # model space coords.  Mark 050930
        if 0:
            from graphics.drawing.CS_draw_primitives import drawline
            from utilities.constants import yellow
            drawline(yellow, self.center, self.center + self.planeNorm, 0, 3)
コード例 #2
0
 def _draw(self, glpane, dispdef):
     for a in self.atoms:
         # Using dispdef of the atom's chunk instead of the glpane's dispdef fixes bug 373. mark 060122.
         chunk = a.molecule
         dispdef = chunk.get_dispdef(glpane)
         disp, rad = a.howdraw(dispdef)
         # wware 060203 selected bounding box bigger, bug 756
         if self.picked: rad *= 1.01
         drawwirecube(self.color, a.posn(), rad)
コード例 #3
0
ファイル: jig_Gamess.py プロジェクト: elfion/nanoengineer
 def _draw(self, glpane, dispdef):
     for a in self.atoms:
         # Using dispdef of the atom's chunk instead of the glpane's dispdef fixes bug 373. mark 060122.
         chunk = a.molecule
         dispdef = chunk.get_dispdef(glpane)
         disp, rad = a.howdraw(dispdef)
         # wware 060203 selected bounding box bigger, bug 756
         if self.picked: rad *= 1.01
         drawwirecube(self.color, a.posn(), rad)
コード例 #4
0
ファイル: ESPImage.py プロジェクト: elfion/nanoengineer
    def _draw_jig(self, glpane, color, highlighted = False):
        """
        Draw an ESPImage jig (self) as a plane with an edge and a bounding box.

        @note: this is not called during graphicsMode.Draw_model as with most
            Jigs, but during graphicsMode.Draw_after_highlighting.
        """
        glPushMatrix()

        glTranslatef( self.center[0], self.center[1], self.center[2])
        q = self.quat
        glRotatef( q.angle*180.0/math.pi, q.x, q.y, q.z) 

        #bruce 060207 extensively revised texture code re fixing bug 1059
        if self.tex_name is not None and self.image_obj: 
            # self.image_obj cond is needed, for clear_esp_image() to work
            textureReady = True
            glBindTexture(GL_TEXTURE_2D, self.tex_name)
                # review: maybe this belongs in draw_plane instead?
            self._initTextureEnv() # sets texture params the way we want them
        else:
            textureReady = False
        drawPlane(self.fill_color, self.width, self.width, textureReady,
                  self.opacity, SOLID = True, 
                  pickCheckOnly = self.pickCheckOnly )

        hw = self.width/2.0
        corners_pos = [V(-hw,  hw, 0.0), 
                       V(-hw, -hw, 0.0), 
                       V( hw, -hw, 0.0), 
                       V( hw,  hw, 0.0)]
        drawLineLoop(color, corners_pos)  

        # Draw the ESP Image bbox.
        if self.show_esp_bbox:
            wo = self.image_offset
            eo = self.edge_offset
            drawwirecube(color, V(0.0, 0.0, 0.0), V(hw + eo, hw + eo, wo), 1.0) 
                #drawwirebox

            # This is for debugging purposes. This draws a green normal vector
            # using local space coords. [Mark 050930]
            if 0:
                from graphics.drawing.CS_draw_primitives import drawline
                drawline(green, V(0.0, 0.0, 0.0), V(0.0, 0.0, 1.0), 0, 3)

        glpane.kluge_reset_texture_mode_to_work_around_renderText_bug()

        glPopMatrix()

        # This is for debugging purposes. This draws a yellow normal vector
        # using model space coords. [Mark 050930]
        if 0:
            from graphics.drawing.CS_draw_primitives import drawline
            from utilities.constants import yellow
            drawline(yellow, self.center, self.center + self.planeNorm, 0, 3)
コード例 #5
0
ファイル: DnaMarker.py プロジェクト: elfion/nanoengineer
 def _draw_jig(self, glpane, color, highlighted = False):
     """
     [overrides superclass method]
     """
     if self._should_draw(): # this test is not present in superclass
         for a in self.atoms:
             chunk = a.molecule
             dispdef = chunk.get_dispdef(glpane)
             disp, rad = a.howdraw(dispdef)
             if self.picked:
                 rad *= 1.01
             drawwirecube(color, a.posn(), rad)
             # draw next_atom in a different color than marked_atom
             color = orange # this is the other thing that differs from superclass
     return
コード例 #6
0
 def _draw_jig(self, glpane, color, highlighted = False):
     """
     [overrides superclass method]
     """
     if self._should_draw(): # this test is not present in superclass
         for a in self.atoms:
             chunk = a.molecule
             dispdef = chunk.get_dispdef(glpane)
             disp, rad = a.howdraw(dispdef)
             if self.picked:
                 rad *= 1.01
             drawwirecube(color, a.posn(), rad)
             # draw next_atom in a different color than marked_atom
             color = orange # this is the other thing that differs from superclass
     return
コード例 #7
0
 def _draw_jig(self, glpane, color, highlighted = False):
     """
     [overrides superclass method]
     """
     # note: kluge: called directly from a specialized Chunk, not from self.draw!
     if self._should_draw():
         sitepos = self.site_position() # or, should we assume the atom pos is up to date? yes, use that. ### FIX
         colors = [red, orange, yellow]
         for a in self.parent_atoms():
             chunk = a.molecule
             dispdef = chunk.get_dispdef(glpane)
             disp, rad = a.howdraw(dispdef)
             if self.picked:
                 rad *= 1.01
             color = colors[0]
             drawwirecube(color, a.posn(), rad) # useful??
             drawline( color, a.posn(), sitepos)
             # draw each atom in a different color (at least if there are no more than 3)
             colors = colors[1:] + [color]
             continue
     return
コード例 #8
0
 def _draw_jig(self, glpane, color, highlighted=False):
     """
     [overrides superclass method]
     """
     # note: kluge: called directly from a specialized Chunk, not from self.draw!
     if self._should_draw():
         sitepos = self.site_position(
         )  # or, should we assume the atom pos is up to date? yes, use that. ### FIX
         colors = [red, orange, yellow]
         for a in self.parent_atoms():
             chunk = a.molecule
             dispdef = chunk.get_dispdef(glpane)
             disp, rad = a.howdraw(dispdef)
             if self.picked:
                 rad *= 1.01
             color = colors[0]
             drawwirecube(color, a.posn(), rad)  # useful??
             drawline(color, a.posn(), sitepos)
             # draw each atom in a different color (at least if there are no more than 3)
             colors = colors[1:] + [color]
             continue
     return