當前位置: 首頁>>代碼示例>>Python>>正文


Python Object3DCTools.draw3DGridLines方法代碼示例

本文整理匯總了Python中PyMca5.Object3D.Object3DCTools.draw3DGridLines方法的典型用法代碼示例。如果您正苦於以下問題:Python Object3DCTools.draw3DGridLines方法的具體用法?Python Object3DCTools.draw3DGridLines怎麽用?Python Object3DCTools.draw3DGridLines使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyMca5.Object3D.Object3DCTools的用法示例。


在下文中一共展示了Object3DCTools.draw3DGridLines方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: drawObject

# 需要導入模塊: from PyMca5.Object3D import Object3DCTools [as 別名]
# 或者: from PyMca5.Object3D.Object3DCTools import draw3DGridLines [as 別名]
    def drawObject(self):
        if self.values is None:
            return
        GL.glPushAttrib(GL.GL_ALL_ATTRIB_BITS)
        GL.glShadeModel(GL.GL_FLAT)
        if DEBUG:
            t0=time.time()
        if self.drawMode == 'NONE':
            pass
        elif (GL.glGetIntegerv(GL.GL_RENDER_MODE) == GL.GL_SELECT) or \
           self._vertexSelectionMode:
            GL.glPointSize(self._configuration['common']['pointsize'])
            if self._xyz:
                self.buildPointListXYZ(selection=True)
            else:
                self.buildPointList(selection=True)
        elif self.drawMode == 'POINT':
            GL.glShadeModel(GL.GL_FLAT)
            GL.glPointSize(self._configuration['common']['pointsize'])
            if self._xyz:
                self.buildPointListXYZ(selection=False)
            else:
                self.buildPointList(selection=False)
        elif self.drawMode == 'POINT_SELECTION':
            GL.glShadeModel(GL.GL_FLAT)
            GL.glPointSize(self._configuration['common']['pointsize'])
            self.buildPointList(selection=True)
        elif self.drawMode in ['LINES', 'WIRE']:
            GL.glLineWidth(self._configuration['common']['linewidth'])
            GL.glShadeModel(GL.GL_SMOOTH)
            if self._xyz:
                if self.facets is None:
                    self._getFacets()
                Object3DCTools.drawXYZLines(self.vertices,
                             self.vertexColors,
                             self.values,
                             self.facets,
                             self._configuration['private']['colorfilter'],
                             self._configuration['private']['useminmax'])
                #sys.exit(1)
            elif self.__flat:
                Object3DCTools.draw3DGridLines(self._x,
                                self._y,
                                self._z,
                                self.vertexColors,
                                self.values,
                                self._configuration['private']['colorfilter'],
                                self._configuration['private']['useminmax'])
            else:
                Object3DCTools.draw2DGridLines(self._x,
                                self._y,
                                self._z,
                                self.vertexColors,
                                self.values,
                                self._configuration['private']['colorfilter'],
                                self._configuration['private']['useminmax'])
        elif self.drawMode == "SURFACE":
            GL.glShadeModel(GL.GL_SMOOTH)
            if self._xyz:
                if self.facets is None:
                    self._getFacets()
                Object3DCTools.drawXYZTriangles(self.vertices,
                             self.vertexColors,
                             self.values,
                             self.facets,
                             self._configuration['private']['colorfilter'],
                             self._configuration['private']['useminmax'])

            elif self.__flat:
                Object3DCTools.draw3DGridQuads(self._x,
                            self._y,
                            self._z,
                            self.vertexColors,
                            self.values,
                            self._configuration['private']['colorfilter'],
                            self._configuration['private']['useminmax'])
            else:
                Object3DCTools.draw2DGridQuads(self._x,
                            self._y,
                            self._z,
                            self.vertexColors,
                            self.values,
                            self._configuration['private']['colorfilter'],
                            self._configuration['private']['useminmax'])
        else:
            print("UNSUPPORTED MODE")
        GL.glPopAttrib()
        if DEBUG:
            print("Drawing takes ", time.time() - t0)
開發者ID:PiRK,項目名稱:pymca,代碼行數:91,代碼來源:Object3DMesh.py

示例2: buildWireList

# 需要導入模塊: from PyMca5.Object3D import Object3DCTools [as 別名]
# 或者: from PyMca5.Object3D.Object3DCTools import draw3DGridLines [as 別名]
 def buildWireList(self):
     Object3DCTools.draw3DGridLines(self._x,
                                    self._y,
                                    self._z,
                                    self.vertexColors)
開發者ID:PiRK,項目名稱:pymca,代碼行數:7,代碼來源:Object3DMesh.py

示例3: drawObject

# 需要導入模塊: from PyMca5.Object3D import Object3DCTools [as 別名]
# 或者: from PyMca5.Object3D.Object3DCTools import draw3DGridLines [as 別名]
    def drawObject(self):
        if self.values is None:
            return
        if DEBUG:
            t0=time.time()
        GL.glPushAttrib(GL.GL_ALL_ATTRIB_BITS)
        GL.glShadeModel(GL.GL_FLAT)
        if self.drawMode == 'NONE':
            pass
        elif (GL.glGetIntegerv(GL.GL_RENDER_MODE) == GL.GL_SELECT) or \
           self._vertexSelectionMode:
            self.buildPointList(selection=True)
        elif self.drawMode == 'POINT':
            self.buildPointList(selection=False)
            #self.buildPointListNEW(selection=False)
        elif self.drawMode == 'POINT_SELECTION':
            self.buildPointList(selection=True)
        elif self.drawMode in ['LINES', 'WIRE']:
            Object3DCTools.draw3DGridLines(self._x,
                                       self._y,
                                       self._z,
                                       self.vertexColors,
                                       self.values,
                                       self._configuration['private']['colorfilter'],
                                       self._configuration['private']['useminmax'])
        elif self.drawMode == "SURFACE":
            flag = 1
            i = 0
            for use, value, label, cr, cg, cb, ca in self._configuration['private']['isosurfaces']:
                color = (cr, cg, cb, ca)
                if None in color:
                    color = None
                if use:
                    flag = 0
                    GL.glEnable(GL.GL_LIGHTING)
                    if color is not None:
                        GL.glColor4ub(color[0],
                                      color[1],
                                      color[2],
                                      self._alpha)
                    colorflag = False
                    if self.__isosurfacesDict[i]['list'] > 0:
                        if self.__isosurfacesDict[i]['color'] == color:
                            colorflag = True
                        elif (self.__isosurfacesDict[i]['color'] != None) and\
                             (color != None):
                            colorflag = True
                    if self.__isosurfacesDict[i]['list'] > 0:
                        if (self.__isosurfacesDict[i]['value'] == value) and\
                           colorflag:
                            GL.glCallList(self.__isosurfacesDict[i]['list'])
                            i += 1
                            continue
                        GL.glDeleteLists(self.__isosurfacesDict[i]['list'],
                                            1)
                    self.__isosurfacesDict[i]['value']= value
                    self.__isosurfacesDict[i]['color']= color
                    self.__isosurfacesDict[i]['list'] = GL.glGenLists(1)
                    GL.glNewList(self.__isosurfacesDict[i]['list'],
                                                 GL.GL_COMPILE)

                    GL.glBegin(GL.GL_TRIANGLES)
                    Object3DCTools.gridMarchingCubes(self._x, self._y, self._z, self.values, value, color, (1, 1, 1), 1)
                    #Object3DCTools.gridMarchingCubes(self._x, self._y, self._z, self.values, value, None, (1, 1, 1), 1)
                    GL.glEnd()
                    GL.glEndList()
                    GL.glCallList(self.__isosurfacesDict[i]['list'])
                    GL.glDisable(GL.GL_LIGHTING)
                i += 1
            if flag:
                #This is useless, only isosurfaces makes sense
                Object3DCTools.draw3DGridQuads(self._x,
                                       self._y,
                                       self._z,
                                       self.vertexColors,
                                       self.values,
                                       self._configuration['private']['colorfilter'],
                                       self._configuration['private']['useminmax'])
        else:
            print("UNSUPPORTED MODE")
        GL.glPopAttrib()
        if DEBUG:
            print("Drawing takes ", time.time() - t0)
開發者ID:isaxs,項目名稱:pymca,代碼行數:85,代碼來源:Object3DStack.py


注:本文中的PyMca5.Object3D.Object3DCTools.draw3DGridLines方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。