1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // Author : OPEN CASCADE
23 // File: GLViewer_BaseObjects.h
24 // Created: November, 2004
26 #ifndef GLVIEWER_BASEOBJECTS_H
27 #define GLVIEWER_BASEOBJECTS_H
30 #include "GLViewer_Object.h"
34 #include <TColStd_SequenceOfInteger.hxx>
37 #pragma warning( disable:4251 )
41 \class GLViewer_MarkerSet
44 class GLVIEWER_API GLViewer_MarkerSet : public GLViewer_Object
48 GLViewer_MarkerSet( int number = 1, float size = 5.0, const QString& toolTip = "GLMarker" );
50 ~GLViewer_MarkerSet();
53 virtual void compute();
54 virtual GLViewer_Drawer* createDrawer();
56 virtual GLboolean highlight( GLfloat x, GLfloat y, GLfloat tol = 15.0, GLboolean isCircle = GL_FALSE );
57 virtual GLboolean unhighlight();
58 virtual GLboolean select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect, GLboolean isFull = GL_FALSE,
59 GLboolean isCircle = GL_FALSE, GLboolean isShift = GL_FALSE );
60 virtual GLboolean unselect();
62 virtual GLViewer_Rect* getUpdateRect();
64 virtual void moveObject( float, float, bool fromGroup = false );
66 virtual QByteArray getByteCopy();
67 virtual bool initializeFromByteCopy( QByteArray );
69 virtual bool translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS );
70 virtual bool translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS );
73 virtual bool translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS );
76 //! Sets array of x coords of markers
77 void setXCoord( GLfloat* xCoord, int size );
78 //! Sets array of y coords of markers
79 void setYCoord( GLfloat* yCoord, int size );
81 GLfloat* getXCoord() const { return myXCoord; }
83 GLfloat* getYCoord() const { return myYCoord; }
85 //! Sets markers number
86 void setNumMarkers( GLint );
87 //! returns markers number
88 GLint getNumMarkers() const { return myNumber; };
89 //! Sets merker radius
90 void setMarkerSize( const float size ) { myMarkerSize = size; }
91 //! Returns merker radius
92 float getMarkerSize() const { return myMarkerSize; }
94 //! Export numbers of heghlighted/selected markers
95 void exportNumbers( QList<int>& high, QList<int>& unhigh,
96 QList<int>& sel, QList<int>& unsel );
98 //! Returns selected numbers
99 QList<int> getSelectedElements() { return mySelNumbers; }
100 //! Adds or remove selected number
101 bool addOrRemoveSelected( int index );
102 //! Adds selected numbers
103 void addSelected( const TColStd_SequenceOfInteger& );
104 //! Sets selected nembers
105 void setSelected( const TColStd_SequenceOfInteger& );
111 GLfloat myMarkerSize;
112 QList<int> myHNumbers;
113 QList<int> myUHNumbers;
114 QList<int> mySelNumbers;
115 QList<int> myCurSelNumbers;
116 QList<int> myUSelNumbers;
117 QList<int> myPrevHNumbers;
118 TColStd_SequenceOfInteger mySelectedIndexes;
122 \class GLViewer_Polyline
125 class GLVIEWER_API GLViewer_Polyline: public GLViewer_Object
128 GLViewer_Polyline( int number = 1, float size = 5.0, const QString& toolTip = "GLPolyline" );
129 ~GLViewer_Polyline();
132 virtual void compute();
133 virtual GLViewer_Drawer* createDrawer();
135 virtual GLboolean highlight( GLfloat x, GLfloat y, GLfloat tol = 15.0, GLboolean isCircle = GL_FALSE );
136 virtual GLboolean unhighlight();
137 virtual GLboolean select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect, GLboolean isFull = GL_FALSE,
138 GLboolean isCircle = GL_FALSE, GLboolean isShift = GL_FALSE );
139 virtual GLboolean unselect();
141 virtual GLViewer_Rect* getUpdateRect();
143 virtual void moveObject( float, float, bool fromGroup = false );
145 virtual QByteArray getByteCopy();
146 virtual bool initializeFromByteCopy( QByteArray );
148 virtual bool translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS );
149 virtual bool translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS );
152 virtual bool translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS );
155 //! Sets array of x coords of points
156 void setXCoord( GLfloat* xCoord, int size );
157 //! Sets array of y coords of points
158 void setYCoord( GLfloat* yCoord, int size );
160 GLfloat* getXCoord() const { return myXCoord; }
162 GLfloat* getYCoord() const { return myYCoord; }
164 //! SetS number of points
165 void setNumber( GLint );
166 //! Returns number of points
167 GLint getNumber() const { return myNumber; };
169 //! On/off closed status of polyline
170 void setClosed( GLboolean closed ) { myIsClosed = closed; }
171 //! Checks closed status of polyline
172 GLboolean isClosed() const { return myIsClosed; }
174 //! On/off highlight as whole object status
175 void setHighSelAll( GLboolean highSelAll ) { myHighSelAll = highSelAll; }
176 //! Checks highlight as whole object status
177 GLboolean isHighSelAll() const { return myHighSelAll; }
179 //! Export numbers of highlighted/selected lines
180 void exportNumbers( QList<int>& high, QList<int>& unhigh,
181 QList<int>& sel, QList<int>& unsel );
183 //! Returns numbers of selected lines
184 QList<int> getSelectedElements() { return mySelNumbers; }
190 GLboolean myIsClosed;
191 GLboolean myHighSelAll;
193 QList<int> myHNumbers;
194 QList<int> myUHNumbers;
195 QList<int> mySelNumbers;
196 QList<int> myUSelNumbers;
197 QList<int> myCurSelNumbers;
198 QList<int> myPrevHNumbers;
199 TColStd_SequenceOfInteger mySelectedIndexes;
201 GLboolean myHighFlag;
205 \class GLViewer_TextObject
206 Text as Object for OpenGL
208 class GLVIEWER_API GLViewer_TextObject : public GLViewer_Object
211 GLViewer_TextObject( const QString&, float xPos = 0, float yPos = 0,
212 const QColor& color = QColor( 0, 255, 0 ), const QString& toolTip = "GLText" );
213 ~GLViewer_TextObject();
215 virtual void compute();
216 virtual GLViewer_Drawer* createDrawer();
218 virtual void setDrawer( GLViewer_Drawer* theDrawer );
220 virtual GLboolean highlight( GLfloat x, GLfloat y, GLfloat tol, GLboolean isCircle = GL_FALSE );
221 virtual GLboolean unhighlight();
222 virtual GLboolean select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect, GLboolean isFull = GL_FALSE,
223 GLboolean isCircle = GL_FALSE, GLboolean isShift = GL_FALSE );
224 virtual GLboolean unselect();
226 virtual GLViewer_Rect* getUpdateRect();
228 virtual void moveObject( float, float, bool fromGroup = false );
230 virtual QByteArray getByteCopy();
231 virtual bool initializeFromByteCopy( QByteArray );
233 virtual bool translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS );
234 virtual bool translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS );
237 virtual bool translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS );
240 int getWidth(){ return myWidth; }
241 int getHeight(){ return myWidth; }
242 void setWidth( int w ){ myWidth=w; }
243 void setHeight( int h ){ myHeight=h; }
252 #pragma warning ( default:4251 )