1 // File: GLViewer_Drawer.h
2 // Created: November, 2004
4 // Copyright (C) CEA 2004
6 /***************************************************************************
7 ** Class: GLViewer_Drawer
8 ** Descr: Drawer for GLViewer_Object
10 ** Created: UI team, 01.10.01
11 ****************************************************************************/
12 #ifndef GLVIEWER_DRAWER_H
13 #define GLVIEWER_DRAWER_H
28 #include "GLViewer_Defs.h"
30 class GLViewer_Object;
32 class GLViewer_CoordSystem;
35 #pragma warning( disable:4251 )
38 struct GLVIEWER_API GLViewer_TexIdStored
45 struct GLVIEWER_API GLViewer_TexFindId
49 bool operator < (const GLViewer_TexFindId theStruct) const
51 if ( myViewPortId != theStruct.myViewPortId ) return myViewPortId < theStruct.myViewPortId;
52 else return myFontString < theStruct.myFontString;
56 class GLVIEWER_API GLViewer_TexFont
60 GLViewer_TexFont( QFont* theFont, int theSeparator = 2 );
63 void generateTexture();
64 void drawString( QString theStr, GLdouble theX = 0.0, GLdouble theY = 0.0 );
66 int getSeparator(){ return mySeparator; }
67 void setSeparator( int theSeparator ){ mySeparator = theSeparator; }
69 int getStringWidth( QString );
70 int getStringHeight();
72 static QMap<GLViewer_TexFindId,GLViewer_TexIdStored> TexFontBase;
73 static int LastmyTexStoredId;
85 /***************************************************************************
86 ** Class: GLViewer_Drawer
87 ** Descr: Drawer for GLObject
89 ** Created: UI team, 03.10.01
90 ****************************************************************************/
91 class GLVIEWER_API GLViewer_Drawer
94 enum { GLText_Center = 0, GLText_Left, GLText_Right, GLText_Top, GLText_Bottom };
98 virtual ~GLViewer_Drawer();
100 enum ObjectStatus { OS_Normal = 0, OS_Highlighted = 1, OS_Selected = 2 };
101 enum ClosedStatus { CS_CLOSED = 0, CS_OPEN = 1 };
103 virtual void create( float, float, bool ) = 0;
105 virtual void addObject( GLViewer_Object* theObject ){ myObjects.append( theObject ); }
106 virtual void clear(){ myObjects.clear(); }
108 QString getObjectType() const { return myObjectType; }
109 int getPriority() const { return myPriority; }
111 static void destroyAllTextures();
113 virtual bool translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS );
114 virtual bool translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS );
117 virtual bool translateToEMF( HDC hDC, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS );
120 GLuint loadTexture( const QString& fileName );
121 void drawTexture( GLuint texture, GLint size, GLfloat x, GLfloat y );
123 void drawText( const QString& text,
124 GLfloat xPos, GLfloat yPos,
127 DisplayTextFormat = DTF_BITMAP );
129 void drawGLText( QString text, float x, float y,
130 int hPosition = GLText_Center, int vPosition = GLText_Center,
131 QColor color = Qt::black, bool smallFont = false );
133 static void drawRectangle( GLViewer_Rect*, QColor = Qt::black );
136 virtual void drawText( GLViewer_Object* );
141 QValueList<GLViewer_Object*> myObjects;
144 QString myObjectType;
149 #pragma warning ( default:4251 )
152 #endif // GLVIEWER_DRAWER_H