Exemple #1
0
 def draw_points(self):
     if self.points_display_list is None:
         self.points_display_list = gltbx.gl_managed.display_list()
         self.points_display_list.compile()
         viewer_utils.draw_points(points=self.points,
                                  atom_colors=self.atom_colors,
                                  points_visible=self.points_visible)
         self.points_display_list.end()
     self.points_display_list.call()
 def draw_points (self) :
   if self.points_display_list is None :
     self.points_display_list = gltbx.gl_managed.display_list()
     self.points_display_list.compile()
     viewer_utils.draw_points(
       points = self.points,
       atom_colors = self.atom_colors,
       points_visible = self.points_visible)
     self.points_display_list.end()
   self.points_display_list.call()
 def draw_selection (self, color, use_global_color=False) :
   from scitbx.array_family import flex
   if self.selected_atom_count == 0 :
     return
   if self.selection_display_list is None :
     if use_global_color :
       selection_colors = flex.vec3_double(self.points.size(), color)
     else :
       selection_colors = self.atom_colors
     self.selection_display_list = gltbx.gl_managed.display_list()
     self.selection_display_list.compile()
     draw_mode = self.selection_draw_mode
     if draw_mode is None :
       draw_mode = "bonds_and_atoms"
     if draw_mode == "bonds_and_atoms" :
       viewer_utils.draw_points(
         points         = self.points,
         atom_colors    = selection_colors,
         points_visible = self.selected_points_visible,
         cross_radius   = 0.4)
       if self.flag_show_all_selected_atoms :
         bonds = self.atomic_bonds
       else :
         bonds = self.bonds
       viewer_utils.draw_bonds(
         points        = self.points,
         bonds         = bonds,
         atom_colors   = selection_colors,
         bonds_visible = self.selected_bonds_visible)
     elif draw_mode == "points" :
       viewer_utils.draw_points(
         points         = self.points,
         atom_colors    = selection_colors,
         points_visible = self.atom_selection,
         cross_radius   = 0.4)
     elif draw_mode == "spheres" :
       atom_selection = self.atom_selection
       atom_radii = self.atom_radii
       glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
       for i_seq, point in enumerate(self.points) :
         if atom_selection[i_seq] :
           glColor3f(*selection_colors[i_seq])
           glPushMatrix()
           glTranslated(*point)
           gltbx.util.SolidSphere(radius=atom_radii[i_seq],
                                  slices=50, stacks=50)
           glPopMatrix()
     self.selection_display_list.end()
   self.selection_display_list.call()
Exemple #4
0
 def draw_selection(self, color, use_global_color=False):
     from scitbx.array_family import flex
     if self.selected_atom_count == 0:
         return
     if self.selection_display_list is None:
         if use_global_color:
             selection_colors = flex.vec3_double(self.points.size(), color)
         else:
             selection_colors = self.atom_colors
         self.selection_display_list = gltbx.gl_managed.display_list()
         self.selection_display_list.compile()
         draw_mode = self.selection_draw_mode
         if draw_mode is None:
             draw_mode = "bonds_and_atoms"
         if draw_mode == "bonds_and_atoms":
             viewer_utils.draw_points(
                 points=self.points,
                 atom_colors=selection_colors,
                 points_visible=self.selected_points_visible,
                 cross_radius=0.4)
             if self.flag_show_all_selected_atoms:
                 bonds = self.atomic_bonds
             else:
                 bonds = self.bonds
             viewer_utils.draw_bonds(
                 points=self.points,
                 bonds=bonds,
                 atom_colors=selection_colors,
                 bonds_visible=self.selected_bonds_visible)
         elif draw_mode == "points":
             viewer_utils.draw_points(points=self.points,
                                      atom_colors=selection_colors,
                                      points_visible=self.atom_selection,
                                      cross_radius=0.4)
         elif draw_mode == "spheres":
             atom_selection = self.atom_selection
             atom_radii = self.atom_radii
             glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
             for i_seq, point in enumerate(self.points):
                 if atom_selection[i_seq]:
                     glColor3f(*selection_colors[i_seq])
                     glPushMatrix()
                     glTranslated(*point)
                     gltbx.util.SolidSphere(radius=atom_radii[i_seq],
                                            slices=50,
                                            stacks=50)
                     glPopMatrix()
         self.selection_display_list.end()
     self.selection_display_list.call()