Changeset 987 for trunk/GSASIIplot.py
- Timestamp:
- Jul 11, 2013 3:12:11 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIplot.py
r986 r987 40 40 from OpenGL.GL import * 41 41 from OpenGL.GLU import * 42 from OpenGL.GLUT import *43 42 from OpenGL.GLE import * 44 43 import gltext … … 2686 2685 Rd = np.array([255,0,0]) 2687 2686 Gr = np.array([0,255,0]) 2687 wxGreen = wx.Color(0,255,0) 2688 2688 Bl = np.array([0,0,255]) 2689 2689 Or = np.array([255,128,0]) 2690 wxOrange = wx.Color(255,128,0) 2690 2691 uBox = np.array([[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]]) 2691 2692 uEdges = np.array([ … … 3292 3293 glDisable(GL_COLOR_MATERIAL) 3293 3294 3294 def RenderLabel(x,y,z,label,r,color): 3295 def RenderLabel(x,y,z,label,r,color,matRot): 3296 ''' 3297 color wx.Color object 3298 ''' 3295 3299 glPushMatrix() 3296 3300 glTranslate(x,y,z) 3297 3301 glMultMatrixf(B4mat.T) 3298 3302 glDisable(GL_LIGHTING) 3299 glColor3fv(color)3300 3303 glRasterPos3f(0,0,0) 3301 if bool(glutBitmapCharacter): #seems to only exist in 32 bit Windows 3302 for c in list(label): 3303 glutBitmapCharacter(GLUT_BITMAP_8_BY_13,ord(c)) 3304 else: 3305 text = gltext.TextElement(text=label,font=Font) 3306 text.draw_text(scale=0.025) 3307 # our_font.glPrint(0,0,label) 3304 glMultMatrixf(matRot) 3305 glRotate(180,1,0,0) #fix to flip about x-axis 3306 text = gltext.Text(text=label,font=Font,foreground=color) 3307 text.draw_text(scale=0.025) 3308 3308 glEnable(GL_LIGHTING) 3309 3309 glPopMatrix() … … 3484 3484 3485 3485 if atom[cs+1] == 'type': 3486 RenderLabel(x,y,z,' '+atom[ct],radius, Gr)3486 RenderLabel(x,y,z,' '+atom[ct],radius,wxGreen,matRot) 3487 3487 elif atom[cs+1] == 'name': 3488 RenderLabel(x,y,z,' '+atom[ct-1],radius, Gr)3488 RenderLabel(x,y,z,' '+atom[ct-1],radius,wxGreen,matRot) 3489 3489 elif atom[cs+1] == 'number': 3490 RenderLabel(x,y,z,' '+str(iat),radius, Gr)3490 RenderLabel(x,y,z,' '+str(iat),radius,wxGreen,matRot) 3491 3491 elif atom[cs+1] == 'residue' and atom[ct-1] == 'CA': 3492 RenderLabel(x,y,z,' '+atom[ct-4],radius, Gr)3492 RenderLabel(x,y,z,' '+atom[ct-4],radius,wxGreen,matRot) 3493 3493 elif atom[cs+1] == '1-letter' and atom[ct-1] == 'CA': 3494 RenderLabel(x,y,z,' '+atom[ct-3],radius, Gr)3494 RenderLabel(x,y,z,' '+atom[ct-3],radius,wxGreen,matRot) 3495 3495 elif atom[cs+1] == 'chain' and atom[ct-1] == 'CA': 3496 RenderLabel(x,y,z,' '+atom[ct-2],radius, Gr)3496 RenderLabel(x,y,z,' '+atom[ct-2],radius,wxGreen,matRot) 3497 3497 # glDisable(GL_BLEND) 3498 3498 if len(rhoXYZ): … … 3517 3517 RenderSphere(x,y,z,0.2,color/255.) 3518 3518 RenderBonds(x,y,z,rbBonds[ind],0.03,Gr) 3519 RenderLabel(x,y,z,name,0.2, Or)3519 RenderLabel(x,y,z,name,0.2,wxOrange,matRot) 3520 3520 if len(mcsaModels) > 1 and pageName == 'MC/SA': #skip the default MD entry 3521 3521 for ind,[x,y,z] in enumerate(mcsaXYZ): … … 3525 3525 RenderSphere(x,y,z,0.2,color/255.) 3526 3526 RenderBonds(x,y,z,mcsaBonds[ind],0.03,Gr) 3527 RenderLabel(x,y,z,name,0.2, Or)3527 RenderLabel(x,y,z,name,0.2,wxOrange,matRot) 3528 3528 if Backbones: 3529 3529 for chain in Backbones: … … 3778 3778 glPopMatrix() 3779 3779 3780 def RenderLabel(x,y,z,label ):3780 def RenderLabel(x,y,z,label,matRot): 3781 3781 glPushMatrix() 3782 3782 glTranslate(x,y,z) 3783 3783 glDisable(GL_LIGHTING) 3784 glColor3f(1.0,1.0,1.0)3785 3784 glRasterPos3f(0,0,0) 3786 if bool(glutBitmapCharacter): 3787 for c in list(label): 3788 glutBitmapCharacter(GLUT_BITMAP_8_BY_13,ord(c)) 3789 else: 3790 text = gltext.TextElement(text=label,font=Font) 3791 text.draw_text(scale=0.025) 3785 glMultMatrixf(matRot) 3786 glRotate(180,1,0,0) #fix to flip about x-axis 3787 text = gltext.TextElement(text=label,font=Font,foreground=wx.WHITE) 3788 text.draw_text(scale=0.025) 3792 3789 glEnable(GL_LIGHTING) 3793 3790 glPopMatrix() … … 3827 3824 RenderSphere(x,y,z,radius,color) 3828 3825 RenderBonds(x,y,z,Bonds[iat],0.05,color) 3829 RenderLabel(x,y,z,' '+atNames[iat] )3826 RenderLabel(x,y,z,' '+atNames[iat],matRot) 3830 3827 Page.canvas.SwapBuffers() 3831 3828
Note: See TracChangeset
for help on using the changeset viewer.