1 // File: GLViewer_Context.h
2 // Created: November, 2004
4 // Copyright (C) CEA 2004
6 /***************************************************************************
7 ** Class: GLViewer_Context
8 ** Descr: OpenGL Context
10 ** Created: UI team, 04.09.02
11 ****************************************************************************/
12 #ifndef GLVIEWER_CONTEXT_H
13 #define GLVIEWER_CONTEXT_H
20 #include "GLViewer_Object.h"
23 #include <qvaluelist.h>
28 #include <Quantity_NameOfColor.hxx>
29 #include <Quantity_Color.hxx>
33 typedef QMap<GLViewer_Object*,int> ObjectMap;
34 typedef QValueList<GLViewer_Object*> ObjList;
36 class GLViewer_Viewer2d;
39 #pragma warning( disable:4251 )
50 class GLVIEWER_EXPORT GLViewer_Context : public QObject
55 GLViewer_Context( GLViewer_Viewer2d* );
58 int MoveTo( int x, int y, bool byCircle = FALSE );
59 int Select( bool Append = FALSE, bool byCircle = FALSE );
60 int SelectByRect( const QRect&, bool Append = FALSE );
62 void SetHighlightColor( Quantity_NameOfColor aCol );
63 void SetSelectionColor( Quantity_NameOfColor aCol );
64 Quantity_NameOfColor HighlightColor() { return myHighlightColor; }
65 Quantity_NameOfColor SelectionColor() { return mySelectionColor; }
70 GLViewer_Object* SelectedObject();
72 bool isSelected( GLViewer_Object* );
74 int insertObject( GLViewer_Object*, bool display = FALSE );
75 bool replaceObject( GLViewer_Object*, GLViewer_Object* );
76 void updateScales( GLfloat, GLfloat );
77 void setTolerance( int tol ) { myTolerance = tol; }
78 const ObjectMap& getObjects() { return myObjects; }
79 const ObjList& getObjList() { return myObjList; }
80 GLViewer_Object* getFirstObject() { return myObjects.begin().key(); }
82 void clearSelected( bool updateViewer );
83 void setSelected( GLViewer_Object*, bool updateViewer );
84 void remSelected( GLViewer_Object*, bool updateViewer );
86 GLViewer_Object* getCurrentObject() { return myLastPicked; }
87 bool currentObjectIsChanged() { return isLastPickedChanged; }
89 void eraseObject( GLViewer_Object*, bool updateViewer = true );
90 void deleteObject( GLViewer_Object*, bool updateViewer = true );
93 GLViewer_Viewer2d* myGLViewer2d;
94 GLViewer_Object* myLastPicked;
95 bool isLastPickedChanged;
99 QValueList<int> mySelNumbers;
104 Quantity_NameOfColor myHighlightColor;
105 Quantity_NameOfColor mySelectionColor;
112 #pragma warning ( default:4251 )