1 // Copyright (C) 2007-2016 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, or (at your option) any later version.
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;
60 bool isHasShift() const;
67 void setSketchButton( int );
69 virtual bool isDefault() const;
70 virtual bool eventFilter( QObject*, QEvent* );
73 void onDrawViewPort();
76 enum SketchState { Debut, EnTrain, Fin };
77 virtual bool onKey( QKeyEvent* );
78 virtual void onMouse( QMouseEvent* );
79 virtual void onSketch( SketchState ) = 0;
80 virtual void onActivate();
81 virtual void onDeactivate();
85 OCCViewer_ViewWindow* mypViewWindow;
89 QCursor mySavedCursor;
90 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 )