1 // File: GLViewer_BaseObjects.h
2 // Created: November, 2004
4 // Copyright (C) CEA 2004
6 #ifndef GLVIEWER_BASEOBJECTS_H
7 #define GLVIEWER_BASEOBJECTS_H
10 #include "GLViewer_Object.h"
13 #include <qvaluelist.h>
15 #include <TColStd_SequenceOfInteger.hxx>
18 #pragma warning( disable:4251 )
21 // Class: GLViewer_MarkerSet
22 // Descr: OpenGL MarkerSet
24 class GLVIEWER_API GLViewer_MarkerSet : public GLViewer_Object
27 GLViewer_MarkerSet( int number = 1, float size = 5.0, const QString& toolTip = "GLMarker" );
28 ~GLViewer_MarkerSet();
30 virtual void compute();
31 virtual GLViewer_Drawer* createDrawer();
33 virtual GLboolean highlight( GLfloat x, GLfloat y, GLfloat tol = 15.0, GLboolean isCircle = GL_FALSE );
34 virtual GLboolean unhighlight();
35 virtual GLboolean select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect, GLboolean isFull = GL_FALSE,
36 GLboolean isCircle = GL_FALSE, GLboolean isShift = GL_FALSE );
37 virtual GLboolean unselect();
39 virtual GLViewer_Rect* getUpdateRect();
41 void setXCoord( GLfloat* xCoord, int size );
42 void setYCoord( GLfloat* yCoord, int size );
43 GLfloat* getXCoord() const { return myXCoord; }
44 GLfloat* getYCoord() const { return myYCoord; }
45 void setNumMarkers( GLint );
46 GLint getNumMarkers() const { return myNumber; };
48 void setMarkerSize( const float size ) { myMarkerSize = size; }
49 float getMarkerSize() const { return myMarkerSize; }
51 void exportNumbers( QValueList<int>&, QValueList<int>& , QValueList<int>&, QValueList<int>& );
53 QValueList<int> getSelectedElements() { return mySelNumbers; }
54 bool addOrRemoveSelected( int index );
55 void addSelected( const TColStd_SequenceOfInteger& );
56 void setSelected( const TColStd_SequenceOfInteger& );
58 virtual void moveObject( float, float, bool fromGroup = false );
60 virtual QByteArray getByteCopy();
61 virtual bool initializeFromByteCopy( QByteArray );
63 virtual bool translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS );
64 virtual bool translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS );
67 virtual bool translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS );
75 QValueList<int> myHNumbers;
76 QValueList<int> myUHNumbers;
77 QValueList<int> mySelNumbers;
78 QValueList<int> myCurSelNumbers;
79 QValueList<int> myUSelNumbers;
80 QValueList<int> myPrevHNumbers;
81 TColStd_SequenceOfInteger mySelectedIndexes;
84 // Class: GLViewer_Polyline
85 // Descr: OpenGL Polyline
87 class GLVIEWER_API GLViewer_Polyline: public GLViewer_Object
90 GLViewer_Polyline( int number = 1, float size = 5.0, const QString& toolTip = "GLPolyline" );
93 virtual void compute();
94 virtual GLViewer_Drawer* createDrawer();
96 virtual GLboolean highlight( GLfloat x, GLfloat y, GLfloat tol = 15.0, GLboolean isCircle = GL_FALSE );
97 virtual GLboolean unhighlight();
98 virtual GLboolean select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect, GLboolean isFull = GL_FALSE,
99 GLboolean isCircle = GL_FALSE, GLboolean isShift = GL_FALSE );
100 virtual GLboolean unselect();
102 virtual GLViewer_Rect* getUpdateRect();
104 void setXCoord( GLfloat* xCoord, int size );
105 void setYCoord( GLfloat* yCoord, int size );
106 GLfloat* getXCoord() const { return myXCoord; }
107 GLfloat* getYCoord() const { return myYCoord; }
108 void setNumber( GLint );
109 GLint getNumber() const { return myNumber; };
111 void setClosed( GLboolean closed ) { myIsClosed = closed; }
112 GLboolean isClosed() const { return myIsClosed; }
114 void setHighSelAll( GLboolean highSelAll ) { myHighSelAll = highSelAll; }
115 GLboolean isHighSelAll() const { return myHighSelAll; }
117 void exportNumbers( QValueList<int>&, QValueList<int>& , QValueList<int>&, QValueList<int>& );
119 QValueList<int> getSelectedElements() { return mySelNumbers; }
121 virtual void moveObject( float, float, bool fromGroup = false );
123 virtual QByteArray getByteCopy();
124 virtual bool initializeFromByteCopy( QByteArray );
126 virtual bool translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS );
127 virtual bool translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS );
130 virtual bool translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS );
137 GLboolean myIsClosed;
138 GLboolean myHighSelAll;
140 QValueList<int> myHNumbers;
141 QValueList<int> myUHNumbers;
142 QValueList<int> mySelNumbers;
143 QValueList<int> myUSelNumbers;
144 QValueList<int> myCurSelNumbers;
145 QValueList<int> myPrevHNumbers;
146 TColStd_SequenceOfInteger mySelectedIndexes;
148 GLboolean myHighFlag;
151 // Class: GLViewer_TextObject
152 // Descr: Text as Object for OpenGL
154 class GLVIEWER_API GLViewer_TextObject : public GLViewer_Object
157 GLViewer_TextObject( const QString&, float xPos = 0, float yPos = 0,
158 const QColor& color = QColor( 0, 255, 0 ), const QString& toolTip = "GLText" );
159 ~GLViewer_TextObject();
161 virtual void compute();
162 virtual GLViewer_Drawer* createDrawer();
164 virtual void setDrawer( GLViewer_Drawer* theDrawer );
166 virtual GLboolean highlight( GLfloat x, GLfloat y, GLfloat tol, GLboolean isCircle = GL_FALSE );
167 virtual GLboolean unhighlight();
168 virtual GLboolean select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect, GLboolean isFull = GL_FALSE,
169 GLboolean isCircle = GL_FALSE, GLboolean isShift = GL_FALSE );
170 virtual GLboolean unselect();
172 virtual GLViewer_Rect* getUpdateRect();
174 virtual void moveObject( float, float, bool fromGroup = false );
176 virtual QByteArray getByteCopy();
177 virtual bool initializeFromByteCopy( QByteArray );
179 virtual bool translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS );
180 virtual bool translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS );
183 virtual bool translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS );
186 int getWidth(){ return myWidth; }
187 int getHeight(){ return myWidth; }
188 void setWidth( int w ){ myWidth=w; }
189 void setHeight( int h ){ myHeight=h; }
198 #pragma warning ( default:4251 )