1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
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
20 #ifndef OCCVIEWER_VIEWSKETCHER_H
21 #define OCCVIEWER_VIEWSKETCHER_H
23 #include "OCCViewer.h"
29 class OCCViewer_ViewWindow;
34 class QtxRectRubberBand;
35 class QtxPolyRubberBand;
38 #pragma warning ( disable:4251 )
42 \class OCCViewer_ViewSketcher
45 class OCCVIEWER_EXPORT OCCViewer_ViewSketcher : public QObject
50 enum { Neutral, Accept, Reject };
53 OCCViewer_ViewSketcher( OCCViewer_ViewWindow*, int );
54 virtual ~OCCViewer_ViewSketcher();
59 int buttonState() const;
66 void setSketchButton( int );
68 virtual bool isDefault() const;
69 virtual bool eventFilter( QObject*, QEvent* );
72 void onDrawViewPort();
75 enum SketchState { Debut, EnTrain, Fin };
76 virtual bool onKey( QKeyEvent* );
77 virtual void onMouse( QMouseEvent* );
78 virtual void onSketch( SketchState ) = 0;
79 virtual void onActivate();
80 virtual void onDeactivate();
84 OCCViewer_ViewWindow* mypViewWindow;
88 QCursor mySavedCursor;
89 QPoint myStart, myCurr;
94 \class OCCViewer_RectSketcher
97 class OCCVIEWER_EXPORT OCCViewer_RectSketcher : public OCCViewer_ViewSketcher
100 OCCViewer_RectSketcher( OCCViewer_ViewWindow*, int );
101 virtual ~OCCViewer_RectSketcher();
104 virtual bool onKey( QKeyEvent* );
105 virtual void onMouse( QMouseEvent* );
106 virtual void onSketch( SketchState );
107 virtual void onActivate();
108 virtual void onDeactivate();
110 QtxRectRubberBand* mypRectRB;
114 \class OCCViewer_PolygonSketcher
117 class OCCVIEWER_EXPORT OCCViewer_PolygonSketcher : public OCCViewer_ViewSketcher
120 OCCViewer_PolygonSketcher( OCCViewer_ViewWindow*, int );
121 virtual ~OCCViewer_PolygonSketcher();
124 virtual bool onKey( QKeyEvent* );
125 virtual void onMouse( QMouseEvent* );
126 virtual void onSketch( SketchState );
127 virtual void onActivate();
128 virtual void onDeactivate();
131 bool isValid( const QPolygon*, const QPoint& ) const;
132 bool isIntersect( const QPoint&, const QPoint&,
133 const QPoint&, const QPoint& ) const;
142 QtxPolyRubberBand* mypPolyRB;
146 #pragma warning( default:4251 )