1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #ifndef OCCVIEWER_VIEWSKETCHER_H
20 #define OCCVIEWER_VIEWSKETCHER_H
22 #include "OCCViewer.h"
27 class OCCViewer_ViewWindow;
30 #pragma warning ( disable:4251 )
34 \class OCCViewer_ViewSketcher
37 class OCCVIEWER_EXPORT OCCViewer_ViewSketcher : public QObject
42 enum { Neutral, Accept, Reject };
45 OCCViewer_ViewSketcher( OCCViewer_ViewWindow*, int );
46 virtual ~OCCViewer_ViewSketcher();
51 int buttonState() const;
58 void setSketchButton( int );
60 virtual bool isDefault() const;
61 virtual bool eventFilter( QObject*, QEvent* );
64 void onDrawViewPort();
67 enum SketchState { Debut, EnTrain, Fin };
68 virtual bool onKey( QKeyEvent* );
69 virtual void onMouse( QMouseEvent* );
70 virtual void onSketch( SketchState ) = 0;
71 virtual void onActivate();
72 virtual void onDeactivate();
76 OCCViewer_ViewWindow* mypViewWindow;
80 QCursor mySavedCursor;
81 QPoint myStart, myCurr;
86 \class OCCViewer_RectSketcher
89 class OCCVIEWER_EXPORT OCCViewer_RectSketcher : public OCCViewer_ViewSketcher
92 OCCViewer_RectSketcher( OCCViewer_ViewWindow*, int );
93 virtual ~OCCViewer_RectSketcher();
96 virtual bool onKey( QKeyEvent* );
97 virtual void onMouse( QMouseEvent* );
98 virtual void onSketch( SketchState );
99 virtual void onActivate();
100 virtual void onDeactivate();
104 \class OCCViewer_PolygonSketcher
107 class OCCVIEWER_EXPORT OCCViewer_PolygonSketcher : public OCCViewer_ViewSketcher
110 OCCViewer_PolygonSketcher( OCCViewer_ViewWindow*, int );
111 virtual ~OCCViewer_PolygonSketcher();
114 virtual bool onKey( QKeyEvent* );
115 virtual void onMouse( QMouseEvent* );
116 virtual void onSketch( SketchState );
117 virtual void onActivate();
118 virtual void onDeactivate();
121 bool isValid( const QPointArray*, const QPoint& ) const;
122 bool isIntersect( const QPoint&, const QPoint&,
123 const QPoint&, const QPoint& ) const;
128 QPointArray* mypPoints;
134 #pragma warning( default:4251 )