#include <GLViewer_BaseDrawers.h>

Public Types | |
| enum | { GLText_Center = 0, GLText_Left, GLText_Right, GLText_Top, GLText_Bottom } |
Text position relatively object. More... | |
Public Member Functions | |
| GLViewer_TextDrawer () | |
| ~GLViewer_TextDrawer () | |
| virtual void | create (float, float, bool) |
| Redefined method. | |
| void | updateObjects () |
| Updates objects after updating font. | |
| virtual void | addObject (GLViewer_Object *theObject) |
| Adds object to drawer display list. | |
| virtual void | clear () |
| Clears drawer display list. | |
| QString | getObjectType () const |
| Returns object type (needs for dynamic search of right drawer ) | |
| int | getPriority () const |
| Returns object priority. | |
| void | setAntialiasing (const bool on) |
| The function enables and disables antialiasing in Open GL (for points, lines and polygons). | |
| virtual bool | translateToHPGL (QFile &hFile, GLViewer_CoordSystem *aViewerCS, GLViewer_CoordSystem *aHPGLCS) |
| A function translate object in to HPGL file on disk. | |
| virtual bool | translateToPS (QFile &hFile, GLViewer_CoordSystem *aViewerCS, GLViewer_CoordSystem *aPSCS) |
| A function translate object in to PostScript file on disk. | |
| void | drawTexture (GLuint texture, GLint size, GLfloat x, GLfloat y) |
| Draw square texture. | |
| void | drawTexture (GLuint texture, GLint x_size, GLint y_size, GLfloat x, GLfloat y) |
| Draw texture. | |
| void | drawTexturePart (GLuint texture, GLfloat x_ratio, GLfloat y_ratio, GLfloat x_size, GLfloat y_size, GLfloat x, GLfloat y, GLfloat scale=0) |
| Draw texture part. | |
| void | drawText (const QString &text, GLfloat xPos, GLfloat yPos, const QColor &color, QFont *aFont, int theSeparator, DisplayTextFormat=DTF_BITMAP) |
| Draw text string. | |
| void | drawGLText (QString text, float x, float y, int hPosition=GLText_Center, int vPosition=GLText_Center, QColor color=Qt::black, bool smallFont=false) |
| Draw text string. | |
| void | setFont (const QFont &font) |
| Sets a default font to be used by drawGLText method. | |
| QFont | font () const |
| Returns a default font used by drawGLText method. | |
| void | setTextFormat (const DisplayTextFormat format) |
| Sets a default text displaying format to be used by drawGLText method. | |
| DisplayTextFormat | textFormat () const |
| Returns a default text displaying format used by drawGLText method. | |
| void | setTextScale (const GLfloat factor) |
| Sets a text string displaying scale factor (used only with text format DTF_TEXTURE_SCALABLE) | |
| GLfloat | textScale () const |
| Returns a text string displaying scale factor. | |
| GLViewer_Rect | textRect (const QString &) const |
| Returns a rectangle of text (without viewer scale) | |
Static Public Member Functions | |
| static void | destroyAllTextures () |
| Clears all generated textures. | |
| static GLuint | loadTexture (const QString &fileName, GLint *x_size=0, GLint *y_size=0, GLint *t_size=0) |
| Loads texture from file. | |
| static void | drawRectangle (GLViewer_Rect *theRect, QColor=Qt::black) |
| Draw rectangle with predefined color. | |
Protected Member Functions | |
| virtual void | drawText (GLViewer_Object *theObject) |
| Draw object text. | |
Static Protected Member Functions | |
| static void | drawRectangle (GLViewer_Rect *, GLfloat, GLfloat=0, QColor=Qt::black, bool=false, QColor=Qt::white) |
| Draw basic primitives: rectangle, contour, polygon, vertex, cross, arrow. | |
| static void | drawContour (GLViewer_Rect *, QColor, GLfloat, GLushort, bool) |
| static void | drawContour (const GLViewer_PntList &, QColor, GLfloat) |
| static void | drawPolygon (GLViewer_Rect *, QColor, GLushort, bool) |
| static void | drawPolygon (const GLViewer_PntList &, QColor) |
| static void | drawVertex (GLfloat, GLfloat, QColor) |
| static void | drawCross (GLfloat, GLfloat, QColor) |
| static void | drawArrow (const GLfloat red, const GLfloat green, const GLfloat blue, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLboolean=GL_FALSE) |
Protected Attributes | |
| float | myXScale |
| X Scale factor. | |
| float | myYScale |
| Y scale factor. | |
| QList< GLViewer_Object * > | myObjects |
| List of objects. | |
| GLuint | myTextList |
| List generated textures. | |
| QString | myObjectType |
| Type of supporting object. | |
| int | myPriority |
| Dislay priority. | |
| QFont | myFont |
| Default font for drawGLText() method. | |
| DisplayTextFormat | myTextFormat |
| Default text displaying format for drawGLText() method. | |
| GLfloat | myTextScale |
| Scale factor for text string draw, by default 0.125 (used only with text format DTF_TEXTURE_SCALABLE) | |
Drawer for GLViewer_Text
anonymous enum [inherited] |
| GLViewer_TextDrawer::GLViewer_TextDrawer | ( | ) |
Default constructor
References GLViewer_Drawer.myObjectType.
| GLViewer_TextDrawer::~GLViewer_TextDrawer | ( | ) |
Destructor
| void GLViewer_TextDrawer::create | ( | float | xScale, |
| float | yScale, | ||
| bool | onlyUpdate | ||
| ) | [virtual] |
Draws object in GLViewer
| xScale | - current scale along X-direction |
| yScale | - current scale along Y-direction |
| onlyUpdate | - = true if only update highlight-select information |
Implements GLViewer_Drawer.
References GLViewer_Drawer.drawText(), GLViewer_Object.getAspectLine(), GLViewer_AspectLine.getLineColors(), GLViewer_Object.isHighlighted(), GLViewer_Object.isSelected(), GLViewer_Drawer.myObjects, GLViewer_Drawer.myXScale, and GLViewer_Drawer.myYScale.
| void GLViewer_TextDrawer::updateObjects | ( | ) |
Updates objects after updating font
References GLViewer_Drawer.myObjects.
| virtual void GLViewer_Drawer.addObject | ( | GLViewer_Object * | theObject | ) | [virtual, inherited] |
| virtual void GLViewer_Drawer.clear | ( | ) | [virtual, inherited] |
| QString GLViewer_Drawer.getObjectType | ( | ) | const [inherited] |
| int GLViewer_Drawer.getPriority | ( | ) | const [inherited] |
| void GLViewer_Drawer::setAntialiasing | ( | const bool | on | ) | [inherited] |
Enables and disables antialiasing in Open GL (for points, lines and polygons).
| on | - if it is true, antialiasing is enabled |
| void GLViewer_Drawer::destroyAllTextures | ( | ) | [static, inherited] |
Clears all generated textures
References GLViewer_TexFont.TexFontBase.
| bool GLViewer_Drawer::translateToHPGL | ( | QFile & | hFile, |
| GLViewer_CoordSystem * | aViewerCS, | ||
| GLViewer_CoordSystem * | aHPGLCS | ||
| ) | [virtual, inherited] |
| hFile | the name of PostScript file chosen by user |
| aViewerCS | the GLViewer_CoordSystem of window |
| aHPGLCS | the GLViewer_CoordSystem of PostScript page |
Saves object to file with format of HPGL
| hFile | - file |
| aViewerCS | - viewer co-ordinate system |
| aHPGLCS | - paper co-ordinate system |
References GLViewer_Drawer.myObjects.
| bool GLViewer_Drawer::translateToPS | ( | QFile & | hFile, |
| GLViewer_CoordSystem * | aViewerCS, | ||
| GLViewer_CoordSystem * | aPSCS | ||
| ) | [virtual, inherited] |
| hFile | the name of PostScript file chosen by user |
| aViewerCS | the GLViewer_CoordSystem of window |
| aPSCS | the GLViewer_CoordSystem of PostScript page |
Saves object to file with format of PostScript
| hFile | - file |
| aViewerCS | - viewer co-ordinate system |
| aPSCS | - paper co-ordinate system |
References GLViewer_Drawer.myObjects.
| GLuint GLViewer_Drawer::loadTexture | ( | const QString & | fileName, |
| GLint * | x_size = 0, |
||
| GLint * | y_size = 0, |
||
| GLint * | t_size = 0 |
||
| ) | [static, inherited] |
| fileName | - the name of texture file |
| x_size | - the horizontal size of picture ( less or equal texture horizontal size ) |
| y_size | - the vertical size of picture ( less or equal texture vertical size ) |
| t_size | - the size of texture ( texture vertical size equals texture horizontal size ) |
Loads texture from file
| fileName | - the name of texture file |
| x_size | - the horizontal size of picture ( less or equal texture horizontal size ) |
| y_size | - the vertical size of picture ( less or equal texture vertical size ) |
| t_size | - the size of texture ( texture vertical size equals texture horizontal size ) |
References test_table.a.
| void GLViewer_Drawer::drawTexture | ( | GLuint | texture, |
| GLint | size, | ||
| GLfloat | x, | ||
| GLfloat | y | ||
| ) | [inherited] |
| texture | - the texture ID |
| size | - the size of square texture |
| x | - x coord |
| y | - y coord |
Draw square texture
| texture | - the texture ID |
| size | - the size of square texture |
| x | - x coord |
| y | - y coord |
| void GLViewer_Drawer::drawTexture | ( | GLuint | texture, |
| GLint | x_size, | ||
| GLint | y_size, | ||
| GLfloat | x, | ||
| GLfloat | y | ||
| ) | [inherited] |
| texture | - the texture ID |
| x_size | - the horizontal size of texture |
| y_size | - the vertical size of texture |
| x | - x coord |
| y | - y coord |
Draw texture
| texture | - the texture ID |
| x_size | - the horizontal size of texture |
| y_size | - the vertical size of texture |
| x | - x coord |
| y | - y coord |
References GLViewer_Drawer.drawTexturePart().
| void GLViewer_Drawer::drawTexturePart | ( | GLuint | texture, |
| GLfloat | x_ratio, | ||
| GLfloat | y_ratio, | ||
| GLfloat | x_size, | ||
| GLfloat | y_size, | ||
| GLfloat | x, | ||
| GLfloat | y, | ||
| GLfloat | scale = 0 |
||
| ) | [inherited] |
| texture | - the texture ID |
| x_ratio | - the horizontal ratio of texture part |
| y_ratio | - the vertical ratio of texture part |
| x_size | - the horizontal size of texture |
| y_size | - the vertical size of texture |
| x | - x coord |
| y | - y coord |
| scale | - common scale factor ( if = 0, use drawer scales ) |
Draw texture part
| texture | - the texture ID |
| x_ratio | - the horizontal ratio of texture part |
| y_ratio | - the vertical ratio of texture part |
| x_size | - the horizontal size of texture |
| y_size | - the vertical size of texture |
| x | - x coord |
| y | - y coord |
| scale | - common scale factor ( if = 0, use drawer scales ) |
References GLViewer_Drawer.myXScale, and GLViewer_Drawer.myYScale.
| void GLViewer_Drawer::drawText | ( | const QString & | text, |
| GLfloat | xPos, | ||
| GLfloat | yPos, | ||
| const QColor & | color, | ||
| QFont * | theFont, | ||
| int | theSeparator, | ||
| DisplayTextFormat | theFormat = DTF_BITMAP |
||
| ) | [inherited] |
| text | - the text string |
| xPos | - x coord |
| yPos | - y coord |
| color | - text color |
| aFont | - base font of text |
| theSeparator | - letter separator |
| DisplayTextFormat | - text format |
Draw text
| text | - text to be drawn |
| xPos | - x position |
| yPos | - y position |
| color | - color of text |
| theFont | - font of text |
| theSeparator | - letter separator |
| theFormat | - text format (by default DTF_BITMAP) |
References displayListBase(), GLViewer_TexFont.drawString(), DTF_BITMAP, DTF_TEXTURE_SCALABLE, GLViewer_TexFont.generateTexture(), and GLViewer_Drawer.textScale().
| void GLViewer_Drawer::drawText | ( | GLViewer_Object * | theObject | ) | [protected, virtual, inherited] |
| void GLViewer_Drawer::drawGLText | ( | QString | text, |
| float | x, | ||
| float | y, | ||
| int | hPosition = GLText_Center, |
||
| int | vPosition = GLText_Center, |
||
| QColor | color = Qt::black, |
||
| bool | smallFont = false |
||
| ) | [inherited] |
| text | - the text string |
| x | - x coord |
| y | - y coord |
| hPosition | - horizontal alignment |
| vPosition | - vertical alignment |
| color | - text color |
| smallFont | - font format |
Draw text
| text | - the text string |
| x | - x coord |
| y | - y coord |
| hPosition | - horizontal alignment |
| vPosition | - vertical alignment |
| color | - text color |
| smallFont | - font format |
References GLViewer_Drawer.drawText(), DTF_TEXTURE_SCALABLE, GLViewer_Drawer.GLText_Bottom, GLViewer_Drawer.GLText_Center, GLViewer_Drawer.GLText_Left, GLViewer_Drawer.GLText_Right, GLViewer_Drawer.GLText_Top, GLViewer_Drawer.myFont, GLViewer_Drawer.myTextFormat, GLViewer_Drawer.myXScale, GLViewer_Drawer.myYScale, and GLViewer_Drawer.textScale().
| void GLViewer_Drawer.setFont | ( | const QFont & | font | ) | [inherited] |
| font | - the default font |
| QFont GLViewer_Drawer.font | ( | ) | const [inherited] |
| void GLViewer_Drawer.setTextFormat | ( | const DisplayTextFormat | format | ) | [inherited] |
| format | - the default text displaying format |
| DisplayTextFormat GLViewer_Drawer.textFormat | ( | ) | const [inherited] |
| void GLViewer_Drawer.setTextScale | ( | const GLfloat | factor | ) | [inherited] |
| factor | - scale factor |
| GLfloat GLViewer_Drawer.textScale | ( | ) | const [inherited] |
| GLViewer_Rect GLViewer_Drawer::textRect | ( | const QString & | text | ) | const [inherited] |
References DTF_TEXTURE_SCALABLE, GLViewer_Drawer.myFont, GLViewer_Drawer.myTextFormat, and GLViewer_Drawer.textScale().
| void GLViewer_Drawer::drawRectangle | ( | GLViewer_Rect * | rect, |
| QColor | color = Qt::black |
||
| ) | [static, inherited] |
Draws rectangle
| rect | - instance of primitive |
| color | - color of primitive |
References GLViewer_Rect.bottom(), GLViewer_Rect.left(), GLViewer_Rect.right(), and GLViewer_Rect.top().
| void GLViewer_Drawer::drawRectangle | ( | GLViewer_Rect * | rect, |
| GLfloat | lineWidth, | ||
| GLfloat | gap = 0, |
||
| QColor | color = Qt::black, |
||
| bool | filled = false, |
||
| QColor | fillingColor = Qt::white |
||
| ) | [static, protected, inherited] |
Draws rectangle
| rect | - instance of primitive |
| lineWidth | - width of line |
| gap | - gap of rectangle |
| color | - color of primitive |
| filled | - if it is true, then rectangle will be drawn filled with color "fillingColor" |
| fillingColor | - color of filling |
References GLViewer_Rect.bottom(), GLViewer_Rect.left(), GLViewer_Rect.right(), and GLViewer_Rect.top().
| void GLViewer_Drawer::drawContour | ( | GLViewer_Rect * | rect, |
| QColor | color, | ||
| GLfloat | lineWidth, | ||
| GLushort | pattern, | ||
| bool | isStripe | ||
| ) | [static, protected, inherited] |
Draws rectangular contour
| rect | - instance of rectangle |
| color | - color of primitive |
| lineWidth | - width of line |
| pattern | - pattern of line |
| isStripe | - enables line stipple |
References GLViewer_Rect.bottom(), GLViewer_Rect.left(), GLViewer_Rect.right(), and GLViewer_Rect.top().
| void GLViewer_Drawer::drawContour | ( | const GLViewer_PntList & | pntList, |
| QColor | color, | ||
| GLfloat | lineWidth | ||
| ) | [static, protected, inherited] |
Draws contour
| pntList | - list of points |
| color | - color of contour |
| lineWidth | - width of line |
| void GLViewer_Drawer::drawPolygon | ( | GLViewer_Rect * | rect, |
| QColor | color, | ||
| GLushort | pattern, | ||
| bool | isStripe | ||
| ) | [static, protected, inherited] |
Draws rectangle
| rect | - instance of rectangle |
| color | - color of polygon |
| pattern | - pattern of line |
| isStripe | - enables line stipple |
References GLViewer_Rect.bottom(), GLViewer_Rect.left(), GLViewer_Rect.right(), and GLViewer_Rect.top().
| void GLViewer_Drawer::drawPolygon | ( | const GLViewer_PntList & | pntList, |
| QColor | color | ||
| ) | [static, protected, inherited] |
Draws polygon
| pntList | - list of points |
| color | - color of polygon |
| void GLViewer_Drawer::drawVertex | ( | GLfloat | x, |
| GLfloat | y, | ||
| QColor | color | ||
| ) | [static, protected, inherited] |
Draws vertex
| x | - x position |
| y | - y position |
| color | - color of vertex |
| void GLViewer_Drawer::drawCross | ( | GLfloat | x, |
| GLfloat | y, | ||
| QColor | color | ||
| ) | [static, protected, inherited] |
Draws cross
| x | - x position |
| y | - y position |
| color | - color of cross |
| void GLViewer_Drawer::drawArrow | ( | const GLfloat | red, |
| const GLfloat | green, | ||
| const GLfloat | blue, | ||
| GLfloat | lineWidth, | ||
| GLfloat | staff, | ||
| GLfloat | length, | ||
| GLfloat | width, | ||
| GLfloat | x, | ||
| GLfloat | y, | ||
| GLfloat | angle, | ||
| GLboolean | filled = GL_FALSE |
||
| ) | [static, protected, inherited] |
Draws arrow
| red,green,blue | - components of color |
| lineWidth | - width of line |
| staff | - |
| length | - length of arrow |
| width | - width of arrow |
| x | - x position |
| y | - y position |
| angle | - angle of arrow |
| filled | - drawn as filled |
float GLViewer_Drawer.myXScale [protected, inherited] |
float GLViewer_Drawer.myYScale [protected, inherited] |
QList<GLViewer_Object*> GLViewer_Drawer.myObjects [protected, inherited] |
GLuint GLViewer_Drawer.myTextList [protected, inherited] |
QString GLViewer_Drawer.myObjectType [protected, inherited] |
int GLViewer_Drawer.myPriority [protected, inherited] |
QFont GLViewer_Drawer.myFont [protected, inherited] |
DisplayTextFormat GLViewer_Drawer.myTextFormat [protected, inherited] |
GLfloat GLViewer_Drawer.myTextScale [protected, inherited] |