Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GLViewer_Drawer Class Referenceabstract

#include <GLViewer_Drawer.h>

Inheritance diagram for GLViewer_Drawer:
Inheritance graph

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...
 

Detailed Description

Drawer for GLViewer_Objects. Drawer creates only one times per one type of object

Member Enumeration Documentation

anonymous enum
Enumerator
GLText_Center 
GLText_Left 
GLText_Right 
GLText_Top 
GLText_Bottom 

Constructor & Destructor Documentation

GLViewer_Drawer::GLViewer_Drawer ( )
GLViewer_Drawer::~GLViewer_Drawer ( )
virtual

Destructor

References myObjects, and myTextList.

Member Function Documentation

virtual void GLViewer_Drawer::addObject ( GLViewer_Object theObject)
inlinevirtual
virtual void GLViewer_Drawer::clear ( )
inlinevirtual
virtual void GLViewer_Drawer::create ( float  xScale,
float  yScale,
bool  onlyUpdate 
)
pure virtual
void GLViewer_Drawer::destroyAllTextures ( )
static

Clears all generated textures

References GLViewer_TexFont::TexFontBase.

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 
)
staticprotected

Draws arrow

Parameters
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
void GLViewer_Drawer::drawContour ( GLViewer_Rect rect,
QColor  color,
GLfloat  lineWidth,
GLushort  pattern,
bool  isStripe 
)
staticprotected

Draws rectangular contour

Parameters
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 
)
staticprotected

Draws contour

Parameters
pntList- list of points
color- color of contour
lineWidth- width of line
void GLViewer_Drawer::drawCross ( GLfloat  x,
GLfloat  y,
QColor  color 
)
staticprotected

Draws cross

Parameters
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 
)
Parameters
text- the text string
x- x coord
y- y coord
hPosition- horizontal alignment
vPosition- vertical alignment
color- text color
smallFont- font format

Draw text

Parameters
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().

void GLViewer_Drawer::drawPolygon ( GLViewer_Rect rect,
QColor  color,
GLushort  pattern,
bool  isStripe 
)
staticprotected

Draws rectangle

Parameters
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 
)
staticprotected

Draws polygon

Parameters
pntList- list of points
color- color of polygon
void GLViewer_Drawer::drawRectangle ( GLViewer_Rect rect,
QColor  color = Qt::black 
)
static

Draws rectangle

Parameters
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 
)
staticprotected

Draws rectangle

Parameters
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 
)
Parameters
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

Parameters
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().

void GLViewer_Drawer::drawTexture ( GLuint  texture,
GLint  size,
GLfloat  x,
GLfloat  y 
)
Parameters
texture- the texture ID
size- the size of square texture
x- x coord
y- y coord

Draw square texture

Parameters
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 
)
Parameters
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

Parameters
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 
)
Parameters
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

Parameters
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 myXScale, and myYScale.

void GLViewer_Drawer::drawVertex ( GLfloat  x,
GLfloat  y,
QColor  color 
)
staticprotected

Draws vertex

Parameters
x- x position
y- y position
color- color of vertex
QFont GLViewer_Drawer::font ( ) const
inline
QString GLViewer_Drawer::getObjectType ( ) const
inline
int GLViewer_Drawer::getPriority ( ) const
inline
GLuint GLViewer_Drawer::loadTexture ( const QString &  fileName,
GLint *  x_size = 0,
GLint *  y_size = 0,
GLint *  t_size = 0 
)
static
Parameters
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

Parameters
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).

Parameters
on- if it is true, antialiasing is enabled
void GLViewer_Drawer::setFont ( const QFont &  font)
inline
Parameters
font- the default font
void GLViewer_Drawer::setTextFormat ( const DisplayTextFormat  format)
inline
Parameters
format- the default text displaying format
void GLViewer_Drawer::setTextScale ( const GLfloat  factor)
inline
Parameters
factor- scale factor
DisplayTextFormat GLViewer_Drawer::textFormat ( ) const
inline
GLViewer_Rect GLViewer_Drawer::textRect ( const QString &  text) const
Returns
a rectangle of text (without viewer scale)

References DTF_TEXTURE_SCALABLE, myFont, myTextFormat, and textScale().

GLfloat GLViewer_Drawer::textScale ( ) const
inline
bool GLViewer_Drawer::translateToHPGL ( QFile hFile,
GLViewer_CoordSystem aViewerCS,
GLViewer_CoordSystem aHPGLCS 
)
virtual
Parameters
hFilethe name of PostScript file chosen by user
aViewerCSthe GLViewer_CoordSystem of window
aHPGLCSthe GLViewer_CoordSystem of PostScript page

Saves object to file with format of HPGL

Parameters
hFile- file
aViewerCS- viewer co-ordinate system
aHPGLCS- paper co-ordinate system

References myObjects.

bool GLViewer_Drawer::translateToPS ( QFile hFile,
GLViewer_CoordSystem aViewerCS,
GLViewer_CoordSystem aPSCS 
)
virtual
Parameters
hFilethe name of PostScript file chosen by user
aViewerCSthe GLViewer_CoordSystem of window
aPSCSthe GLViewer_CoordSystem of PostScript page

Saves object to file with format of PostScript

Parameters
hFile- file
aViewerCS- viewer co-ordinate system
aPSCS- paper co-ordinate system

References myObjects.

Member Data Documentation

QFont GLViewer_Drawer::myFont
protected
QList<GLViewer_Object*> GLViewer_Drawer::myObjects
protected
QString GLViewer_Drawer::myObjectType
protected
int GLViewer_Drawer::myPriority
protected
DisplayTextFormat GLViewer_Drawer::myTextFormat
protected
GLuint GLViewer_Drawer::myTextList
protected
GLfloat GLViewer_Drawer::myTextScale
protected
float GLViewer_Drawer::myXScale
protected
float GLViewer_Drawer::myYScale
protected

The documentation for this class was generated from the following files: