Changeset 935 for trunk/GSASIIplot.py


Ignore:
Timestamp:
May 29, 2013 9:31:23 AM (10 years ago)
Author:
vondreele
Message:

improve label plotting - now a fixed offset from atom in drawing plane
improve plot performance change glShadeModel to GL_FLAT while plotting density map points, & bond lines, etc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r934 r935  
    31933193               
    31943194    def RenderLines(x,y,z,Bonds,color):
     3195        glShadeModel(GL_FLAT)
    31953196        xyz = np.array([x,y,z])
    31963197        glEnable(GL_COLOR_MATERIAL)
     
    32063207        glPopMatrix()
    32073208        glDisable(GL_COLOR_MATERIAL)
     3209        glShadeModel(GL_SMOOTH)
    32083210       
    32093211    def RenderPolyhedra(x,y,z,Faces,color):
     
    32243226
    32253227    def RenderMapPeak(x,y,z,color,den):
     3228        glShadeModel(GL_FLAT)
    32263229        xyz = np.array([x,y,z])
    32273230        glEnable(GL_COLOR_MATERIAL)
     
    32373240        glPopMatrix()
    32383241        glDisable(GL_COLOR_MATERIAL)
     3242        glShadeModel(GL_SMOOTH)
    32393243       
    32403244    def RenderBackbone(Backbone,BackboneColor,radius):
     
    32543258        glDisable(GL_LIGHTING)
    32553259        glColor3fv(color)
    3256         glRasterPos3f(r,r,r)
     3260        glRasterPos3f(0,0,0)
    32573261        for c in list(label):
    32583262            glutBitmapCharacter(GLUT_BITMAP_8_BY_13,ord(c))
     
    32613265       
    32623266    def RenderMap(rho,rhoXYZ,indx,Rok):
     3267        glShadeModel(GL_FLAT)
    32633268        cLevel = drawingData['contourLevel']
    32643269        XYZ = []
     
    32783283                    RC.append([0.1*alpha,Gr])
    32793284        RenderDots(XYZ,RC)
     3285        glShadeModel(GL_SMOOTH)
    32803286                           
    32813287    def Draw(caller=''):
     
    34333439                   
    34343440            if atom[cs+1] == 'type':
    3435                 RenderLabel(x,y,z,atom[ct],radius,Gr)
     3441                RenderLabel(x,y,z,'  '+atom[ct],radius,Gr)
    34363442            elif atom[cs+1] == 'name':
    3437                 RenderLabel(x,y,z,atom[ct-1],radius,Gr)
     3443                RenderLabel(x,y,z,'  '+atom[ct-1],radius,Gr)
    34383444            elif atom[cs+1] == 'number':
    3439                 RenderLabel(x,y,z,str(iat),radius,Gr)
     3445                RenderLabel(x,y,z,'  '+str(iat),radius,Gr)
    34403446            elif atom[cs+1] == 'residue' and atom[ct-1] == 'CA':
    3441                 RenderLabel(x,y,z,atom[ct-4],radius,Gr)
     3447                RenderLabel(x,y,z,'  '+atom[ct-4],radius,Gr)
    34423448            elif atom[cs+1] == '1-letter' and atom[ct-1] == 'CA':
    3443                 RenderLabel(x,y,z,atom[ct-3],radius,Gr)
     3449                RenderLabel(x,y,z,'  '+atom[ct-3],radius,Gr)
    34443450            elif atom[cs+1] == 'chain' and atom[ct-1] == 'CA':
    3445                 RenderLabel(x,y,z,atom[ct-2],radius,Gr)
     3451                RenderLabel(x,y,z,'  '+atom[ct-2],radius,Gr)
    34463452#        glDisable(GL_BLEND)
    34473453        if len(rhoXYZ):
     
    34623468            for ind,[x,y,z] in enumerate(XYZ):
    34633469                aType = testRBObj['rbAtTypes'][ind]
    3464                 name = aType+str(ind)
     3470                name = '  '+aType+str(ind)
    34653471                color = np.array(testRBObj['AtInfo'][aType][1])
    34663472                RenderSphere(x,y,z,0.2,color/255.)
     
    34733479            for ind,[x,y,z] in enumerate(XYZ):
    34743480                aType = atTypes[ind]
    3475                 name = aType+str(ind)
     3481                name = '  '+aType+str(ind)
    34763482                color = np.array(MCSA['AtInfo'][aType][1])
    34773483                RenderSphere(x,y,z,0.2,color/255.)
     
    37293735        glPopMatrix()
    37303736               
    3731     def RenderLabel(x,y,z,label,r):       
     3737    def RenderLabel(x,y,z,label):       
    37323738        glPushMatrix()
    37333739        glTranslate(x,y,z)
    37343740        glDisable(GL_LIGHTING)
    37353741        glColor3f(1.0,1.0,1.0)
    3736         glRasterPos3f(r,r,r)
     3742        glRasterPos3f(0,0,0)
    37373743        for c in list(label):
    37383744            glutBitmapCharacter(GLUT_BITMAP_8_BY_13,ord(c))
     
    37743780            RenderSphere(x,y,z,radius,color)
    37753781            RenderBonds(x,y,z,Bonds[iat],0.05,color)
    3776             RenderLabel(x,y,z,atNames[iat],radius)
     3782            RenderLabel(x,y,z,'  '+atNames[iat])
    37773783        Page.canvas.SwapBuffers()
    37783784
Note: See TracChangeset for help on using the changeset viewer.