Version: 9.16.0
OCCViewer_ViewSketcher.h
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
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.
7//
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.
12//
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
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#ifndef OCCVIEWER_VIEWSKETCHER_H
21#define OCCVIEWER_VIEWSKETCHER_H
22
23#include "OCCViewer.h"
24
25#include <QObject>
26#include <QCursor>
27#include <QSize>
28
30class QKeyEvent;
31class QMouseEvent;
32class QPolygon;
33
37
38#ifdef WIN32
39#pragma warning ( disable:4251 )
40#endif
41
47{
48 Q_OBJECT
49
50public:
51 enum { Neutral, Accept, Reject };
52
53public:
56
57public:
58 int type() const;
59 int result() const;
60 int buttonState() const;
61 bool isHasShift() const;
62 void* data() const;
63
64 void activate();
65 void deactivate();
66
67 int sketchButton();
68 void setSketchButton( int );
69
70 virtual bool isDefault() const;
71 virtual bool eventFilter( QObject*, QEvent* );
72
73 virtual void setSketcherMode(int) {}
74 virtual int sketcherMode() const { return 0; }
75
76private slots:
77 void onDrawViewPort();
78
79protected:
80 enum SketchState { Debut, EnTrain, Fin };
81 virtual bool onKey( QKeyEvent* );
82 virtual void onMouse( QMouseEvent* );
83 virtual void onSketch( SketchState ) = 0;
84 virtual void onActivate();
85 virtual void onDeactivate();
86
87protected:
90 int myType;
91 void* mypData;
94 QPoint myStart, myCurr;
97};
98
104{
105public:
107 virtual ~OCCViewer_RectSketcher();
108
109protected:
110 virtual bool onKey( QKeyEvent* );
111 virtual void onMouse( QMouseEvent* );
112 virtual void onSketch( SketchState );
113 virtual void onActivate();
114 virtual void onDeactivate();
115 private:
117};
118
124{
125public:
126 enum SketchMode { Poligone, Circle };
127
130
131 virtual void setSketcherMode(int theMode);
132 virtual int sketcherMode() const {
133 return myMode;
134 }
135
136protected:
137 virtual bool onKey( QKeyEvent* );
138 virtual void onMouse( QMouseEvent* );
139 virtual void onSketch( SketchState );
140 virtual void onActivate();
141 virtual void onDeactivate();
142
143private:
144 bool isValid( const QPolygon*, const QPoint& ) const;
145 bool isIntersect( const QPoint&, const QPoint&,
146 const QPoint&, const QPoint& ) const;
147
148private:
149 bool myDbl;
150 QSize myToler;
151 QPolygon* mypPoints;
154
157
159};
160
161#ifdef WIN32
162#pragma warning( default:4251 )
163#endif
164
165#endif
#define OCCVIEWER_EXPORT
Definition: OCCViewer.h:33
bool isValid(const QPolygon *thePoints, const QPoint &theCurrent)
Definition: SVTK_InteractorStyle.cxx:1762
bool isIntersect(const QPoint &theStart1, const QPoint &theEnd1, const QPoint &theStart2, const QPoint &theEnd2)
Definition: SVTK_InteractorStyle.cxx:1711
Definition: OCCViewer_ViewSketcher.h:124
bool myDbl
Definition: OCCViewer_ViewSketcher.h:149
QtxPolyRubberBand * mypPolyRB
Definition: OCCViewer_ViewSketcher.h:155
SketchMode myMode
Definition: OCCViewer_ViewSketcher.h:158
QPolygon * mypPoints
Definition: OCCViewer_ViewSketcher.h:151
QSize myToler
Definition: OCCViewer_ViewSketcher.h:150
virtual int sketcherMode() const
Definition: OCCViewer_ViewSketcher.h:132
int myDelButton
Definition: OCCViewer_ViewSketcher.h:153
SketchMode
Definition: OCCViewer_ViewSketcher.h:126
QtxCircleRubberBand * mypCircleRB
Definition: OCCViewer_ViewSketcher.h:156
int myAddButton
Definition: OCCViewer_ViewSketcher.h:152
Definition: OCCViewer_ViewSketcher.h:104
QtxRectRubberBand * mypRectRB
Definition: OCCViewer_ViewSketcher.h:116
Definition: OCCViewer_ViewSketcher.h:47
int mySketchButton
Definition: OCCViewer_ViewSketcher.h:88
QPoint myCurr
Definition: OCCViewer_ViewSketcher.h:94
int myType
Definition: OCCViewer_ViewSketcher.h:90
@ Accept
Definition: OCCViewer_ViewSketcher.h:51
virtual void setSketcherMode(int)
Definition: OCCViewer_ViewSketcher.h:73
int myResult
Definition: OCCViewer_ViewSketcher.h:92
virtual int sketcherMode() const
Definition: OCCViewer_ViewSketcher.h:74
virtual void onSketch(SketchState)=0
int myButtonState
Definition: OCCViewer_ViewSketcher.h:95
bool myHasShift
Definition: OCCViewer_ViewSketcher.h:96
QCursor mySavedCursor
Definition: OCCViewer_ViewSketcher.h:93
SketchState
Definition: OCCViewer_ViewSketcher.h:80
@ Debut
Definition: OCCViewer_ViewSketcher.h:80
void * mypData
Definition: OCCViewer_ViewSketcher.h:91
OCCViewer_ViewWindow * mypViewWindow
Definition: OCCViewer_ViewSketcher.h:89
Definition: OCCViewer_ViewWindow.h:147
For more information see QT documentation.
Definition: QtxRubberBand.h:98
Definition: QtxRubberBand.h:76
Definition: QtxRubberBand.h:61
@ Circle
Definition: Plot2d.h:75