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 #ifndef OCCVIEWER_VIEWSKETCHER_H
23 #define OCCVIEWER_VIEWSKETCHER_H
25 #include "OCCViewer.h"
31 class OCCViewer_ViewWindow;
36 class QtxRectRubberBand;
37 class QtxPolyRubberBand;
40 #pragma warning ( disable:4251 )
44 \class OCCViewer_ViewSketcher
47 class OCCVIEWER_EXPORT OCCViewer_ViewSketcher : public QObject
52 enum { Neutral, Accept, Reject };
55 OCCViewer_ViewSketcher( OCCViewer_ViewWindow*, int );
56 virtual ~OCCViewer_ViewSketcher();
61 int buttonState() const;
68 void setSketchButton( int );
70 virtual bool isDefault() const;
71 virtual bool eventFilter( QObject*, QEvent* );
74 void onDrawViewPort();
77 enum SketchState { Debut, EnTrain, Fin };
78 virtual bool onKey( QKeyEvent* );
79 virtual void onMouse( QMouseEvent* );
80 virtual void onSketch( SketchState ) = 0;
81 virtual void onActivate();
82 virtual void onDeactivate();
86 OCCViewer_ViewWindow* mypViewWindow;
90 QCursor mySavedCursor;
91 QPoint myStart, myCurr;
96 \class OCCViewer_RectSketcher
99 class OCCVIEWER_EXPORT OCCViewer_RectSketcher : public OCCViewer_ViewSketcher
102 OCCViewer_RectSketcher( OCCViewer_ViewWindow*, int );
103 virtual ~OCCViewer_RectSketcher();
106 virtual bool onKey( QKeyEvent* );
107 virtual void onMouse( QMouseEvent* );
108 virtual void onSketch( SketchState );
109 virtual void onActivate();
110 virtual void onDeactivate();
112 QtxRectRubberBand* mypRectRB;
116 \class OCCViewer_PolygonSketcher
119 class OCCVIEWER_EXPORT OCCViewer_PolygonSketcher : public OCCViewer_ViewSketcher
122 OCCViewer_PolygonSketcher( OCCViewer_ViewWindow*, int );
123 virtual ~OCCViewer_PolygonSketcher();
126 virtual bool onKey( QKeyEvent* );
127 virtual void onMouse( QMouseEvent* );
128 virtual void onSketch( SketchState );
129 virtual void onActivate();
130 virtual void onDeactivate();
133 bool isValid( const QPolygon*, const QPoint& ) const;
134 bool isIntersect( const QPoint&, const QPoint&,
135 const QPoint&, const QPoint& ) const;
144 QtxPolyRubberBand* mypPolyRB;
148 #pragma warning( default:4251 )