#include <GLViewer_Drawer.h>
Public Types | |
enum | { GLText_Center = 0, GLText_Left, GLText_Right, GLText_Top, GLText_Bottom } |
Text position relatively object. More... | |
Public Member Functions | |
GLViewer_Drawer () | |
A constructor. More... | |
virtual | ~GLViewer_Drawer () |
A destructor. More... | |
virtual void | create (float xScale, float yScale, bool onlyUpdate)=0 |
Main method which drawing object in GLViewer. More... | |
virtual void | addObject (GLViewer_Object *theObject) |
Adds object to drawer display list. More... | |
virtual void | clear () |
Clears drawer display list. More... | |
QString | getObjectType () const |
Returns object type (needs for dynamic search of right drawer ) More... | |
int | getPriority () const |
Returns object priority. More... | |
void | setAntialiasing (const bool on) |
The function enables and disables antialiasing in Open GL (for points, lines and polygons). More... | |
virtual bool | translateToHPGL (QFile &hFile, GLViewer_CoordSystem *aViewerCS, GLViewer_CoordSystem *aHPGLCS) |
A function translate object in to HPGL file on disk. More... | |
virtual bool | translateToPS (QFile &hFile, GLViewer_CoordSystem *aViewerCS, GLViewer_CoordSystem *aPSCS) |
A function translate object in to PostScript file on disk. More... | |
void | drawTexture (GLuint texture, GLint size, GLfloat x, GLfloat y) |
Draw square texture. More... | |
void | drawTexture (GLuint texture, GLint x_size, GLint y_size, GLfloat x, GLfloat y) |
Draw texture. More... | |
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. More... | |
void | drawText (const QString &text, GLfloat xPos, GLfloat yPos, const QColor &color, QFont *aFont, int theSeparator, DisplayTextFormat=DTF_BITMAP) |
Draw text string. More... | |
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. More... | |
void | setFont (const QFont &font) |
Sets a default font to be used by drawGLText method. More... | |
QFont | font () const |
Returns a default font used by drawGLText method. More... | |
void | setTextFormat (const DisplayTextFormat format) |
Sets a default text displaying format to be used by drawGLText method. More... | |
DisplayTextFormat | textFormat () const |
Returns a default text displaying format used by drawGLText method. More... | |
void | setTextScale (const GLfloat factor) |
Sets a text string displaying scale factor (used only with text format DTF_TEXTURE_SCALABLE) More... | |
GLfloat | textScale () const |
Returns a text string displaying scale factor. More... | |
GLViewer_Rect | textRect (const QString &) const |
Returns a rectangle of text (without viewer scale) More... | |
Static Public Member Functions | |
static void | destroyAllTextures () |
Clears all generated textures. More... | |
static GLuint | loadTexture (const QString &fileName, GLint *x_size=0, GLint *y_size=0, GLint *t_size=0) |
Loads texture from file. More... | |
static void | drawRectangle (GLViewer_Rect *theRect, QColor=Qt::black) |
Draw rectangle with predefined color. More... | |
Protected Member Functions | |
virtual void | drawText (GLViewer_Object *theObject) |
Draw object text. More... | |
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. More... | |
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. More... | |
float | myYScale |
Y scale factor. More... | |
QList< GLViewer_Object * > | myObjects |
List of objects. More... | |
GLuint | myTextList |
List generated textures. More... | |
QString | myObjectType |
Type of supporting object. More... | |
int | myPriority |
Dislay priority. More... | |
QFont | myFont |
Default font for drawGLText() method. More... | |
DisplayTextFormat | myTextFormat |
Default text displaying format for drawGLText() method. More... | |
GLfloat | myTextScale |
Scale factor for text string draw, by default 0.125 (used only with text format DTF_TEXTURE_SCALABLE) More... | |
Drawer for GLViewer_Objects. Drawer creates only one times per one type of object
GLViewer_Drawer::GLViewer_Drawer | ( | ) |
Default constructor
References DTF_BITMAP, myObjects, myObjectType, myPriority, myTextFormat, myTextList, myTextScale, myXScale, and myYScale.
|
virtual |
Destructor
References myObjects, and myTextList.
|
inlinevirtual |
|
inlinevirtual |
|
pure virtual |
Implemented in GLViewer_TextDrawer, GLViewer_PolylineDrawer, and GLViewer_MarkerDrawer.
|
static |
Clears all generated textures
References GLViewer_TexFont::TexFontBase.
|
staticprotected |
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 |
|
staticprotected |
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().
|
staticprotected |
Draws contour
pntList | - list of points |
color | - color of contour |
lineWidth | - width of line |
|
staticprotected |
Draws cross
x | - x position |
y | - y position |
color | - color of cross |
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 |
||
) |
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 drawText(), DTF_TEXTURE_SCALABLE, GLText_Bottom, GLText_Center, GLText_Left, GLText_Right, GLText_Top, myFont, myTextFormat, myXScale, myYScale, and textScale().
|
staticprotected |
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().
|
staticprotected |
Draws polygon
pntList | - list of points |
color | - color of polygon |
|
static |
Draws rectangle
rect | - instance of primitive |
color | - color of primitive |
References GLViewer_Rect::bottom(), GLViewer_Rect::left(), GLViewer_Rect::right(), and GLViewer_Rect::top().
|
staticprotected |
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::drawText | ( | const QString & | text, |
GLfloat | xPos, | ||
GLfloat | yPos, | ||
const QColor & | color, | ||
QFont * | theFont, | ||
int | theSeparator, | ||
DisplayTextFormat | theFormat = DTF_BITMAP |
||
) |
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 textScale().
|
protectedvirtual |
void GLViewer_Drawer::drawTexture | ( | GLuint | texture, |
GLint | size, | ||
GLfloat | x, | ||
GLfloat | y | ||
) |
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 | ||
) |
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 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 |
||
) |
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 ) |
|
staticprotected |
Draws vertex
x | - x position |
y | - y position |
color | - color of vertex |
|
inline |
|
inline |
|
inline |
|
static |
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 ) |
void GLViewer_Drawer::setAntialiasing | ( | const bool | on | ) |
Enables and disables antialiasing in Open GL (for points, lines and polygons).
on | - if it is true, antialiasing is enabled |
|
inline |
font | - the default font |
|
inline |
format | - the default text displaying format |
|
inline |
factor | - scale factor |
|
inline |
GLViewer_Rect GLViewer_Drawer::textRect | ( | const QString & | text | ) | const |
References DTF_TEXTURE_SCALABLE, myFont, myTextFormat, and textScale().
|
inline |
|
virtual |
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 myObjects.
|
virtual |
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 myObjects.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |