0024623: Visualization - improve selection mechanism
[occt.git] / src / Select3D / Select3D_SensitiveCurve.hxx
1 // Created on: 1995-03-13
2 // Created by: Robert COUBLANC
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _Select3D_SensitiveCurve_HeaderFile
18 #define _Select3D_SensitiveCurve_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineHandle.hxx>
22 #include <Standard_Type.hxx>
23
24 #include <Geom_Curve.hxx>
25 #include <Handle_Geom_Curve.hxx>
26 #include <Select3D_SensitivePoly.hxx>
27 #include <Handle_SelectBasics_EntityOwner.hxx>
28 #include <Handle_TColgp_HArray1OfPnt.hxx>
29 #include <Standard_Boolean.hxx>
30 #include <SelectMgr_SelectingVolumeManager.hxx>
31 #include <Standard_Real.hxx>
32 #include <Standard_OStream.hxx>
33
34 class Geom_Curve;
35 class Standard_ConstructionError;
36 class Standard_OutOfRange;
37 class SelectBasics_EntityOwner;
38 class TColgp_HArray1OfPnt;
39 class TColgp_Array1OfPnt;
40 class Select3D_SensitiveEntity;
41 class TopLoc_Location;
42
43
44 //! A framework to define a sensitive 3D curve.
45 //! In some cases this class can raise Standard_ConstructionError and
46 //! Standard_OutOfRange exceptions. For more details see Select3D_SensitivePoly.
47 class Select3D_SensitiveCurve : public Select3D_SensitivePoly
48 {
49 public:
50
51   //! Constructs a sensitive curve object defined by the
52   //! owner theOwnerId, the curve theCurve, and the
53   //! maximum number of points on the curve: theNbPnts.
54   Standard_EXPORT Select3D_SensitiveCurve (const Handle(SelectBasics_EntityOwner)& theOwnerId,
55                                            const Handle(Geom_Curve)& theCurve,
56                                            const Standard_Integer theNbPnts = 17);
57
58   //! Constructs a sensitive curve object defined by the
59   //! owner theOwnerId and the set of points ThePoints.
60   Standard_EXPORT Select3D_SensitiveCurve (const Handle(SelectBasics_EntityOwner)& theOwnerId,
61                                            const Handle(TColgp_HArray1OfPnt)& thePoints);
62
63   //! Creation of Sensitive Curve from Points.
64   //!          Warning : This Method should disappear in the next version...
65   Standard_EXPORT Select3D_SensitiveCurve (const Handle(SelectBasics_EntityOwner)& theOwnerId,
66                                            const TColgp_Array1OfPnt& thePoints);
67
68   //! Checks whether the curve overlaps current selecting volume
69   Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
70                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
71
72   //! Returns the copy of this
73   Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) GetConnected() Standard_OVERRIDE;
74
75 public:
76
77   DEFINE_STANDARD_RTTI(Select3D_SensitiveCurve)
78
79 private:
80
81   void loadPoints (const Handle(Geom_Curve)& aCurve,
82                    const Standard_Integer NbPoints);
83
84 private:
85
86   Handle_Geom_Curve myCurve;     //!< Curve points
87 };
88
89 DEFINE_STANDARD_HANDLE(Select3D_SensitiveCurve, Select3D_SensitivePoly)
90
91 #endif // _Select3D_SensitiveCurve_HeaderFile