0024623: Visualization - improve selection mechanism
[occt.git] / src / Select3D / Select3D_SensitiveCircle.hxx
CommitLineData
f751596e 1// Created on: 1996-02-06
2// Created by: Robert COUBLANC
3// Copyright (c) 1996-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// Modified Tue Apr 14 1998 by rob : fix Bug : Case of Null Radius Circle...
18
19#ifndef _Select3D_SensitiveCircle_HeaderFile
20#define _Select3D_SensitiveCircle_HeaderFile
21
22#include <Standard.hxx>
23#include <Standard_DefineHandle.hxx>
24#include <Standard_Type.hxx>
25
26#include <Select3D_SensitivePoly.hxx>
27#include <Select3D_Pnt.hxx>
28#include <Handle_Geom_Circle.hxx>
29#include <Handle_SelectBasics_EntityOwner.hxx>
30#include <Handle_TColgp_HArray1OfPnt.hxx>
31#include <SelectMgr_SelectingVolumeManager.hxx>
32#include <Select3D_TypeOfSensitivity.hxx>
33
34class Geom_Circle;
35class Standard_ConstructionError;
36class Standard_OutOfRange;
37class SelectBasics_EntityOwner;
38class TColgp_HArray1OfPnt;
39class TColgp_Array1OfPnt;
40class gp_Pnt;
41class TopLoc_Location;
42
43
44//! A framework to define sensitive 3D arcs and circles.
45//! In some cases this class can raise Standard_ConstructionError and
46//! Standard_OutOfRange exceptions. For more details see Select3D_SensitivePoly.
47class Select3D_SensitiveCircle : public Select3D_SensitivePoly
48{
49public:
50
51 //! Constructs the sensitive circle object defined by the
52 //! owner theOwnerId, the circle theCircle, the boolean
53 //! theIsFilled and the number of points theNbPnts.
54 Standard_EXPORT Select3D_SensitiveCircle (const Handle(SelectBasics_EntityOwner)& theOwnerId,
55 const Handle(Geom_Circle)& theCircle,
56 const Standard_Boolean theIsFilled = Standard_False,
57 const Standard_Integer theNbPnts = 12);
58
59 //! Constructs the sensitive arc object defined by the
60 //! owner theOwnerId, the circle theCircle, the parameters theU1
61 //! and theU2, the boolean theIsFilled and the number of points theNbPnts.
62 //! theU1 and theU2 define the first and last points of the arc on theCircle.
63 Standard_EXPORT Select3D_SensitiveCircle (const Handle(SelectBasics_EntityOwner)& theOwnerId,
64 const Handle(Geom_Circle)& theCircle,
65 const Standard_Real theU1,
66 const Standard_Real theU2,
67 const Standard_Boolean theIsFilled = Standard_False,
68 const Standard_Integer theNbPnts = 12);
69
70 //! Constructs the sensitive circle object defined by the
71 //! owner theOwnerId, the array of triangles thePnts3d, and the boolean theIsFilled.
72 //! thePnts3d is an array of consecutive triangles on the
73 //! circle. The triangle i+1 lies on the intersection of the
74 //! tangents to the circle of i and i+2. Note, that the first point of thePnts3d
75 //! must be equal to the last point of thePnts3d.
76 Standard_EXPORT Select3D_SensitiveCircle (const Handle(SelectBasics_EntityOwner)& theOwnerId,
77 const Handle(TColgp_HArray1OfPnt)& thePnts3d,
78 const Standard_Boolean theIsFilled = Standard_False);
79
80 //! Constructs the sensitive circle object defined by the
81 //! owner theOwnerId, the array of points thePnts3d, and the boolean theIsFilled.
82 //! If the length of thePnts3d is more then 1, the first point of thePnts3d
83 //! must be equal to the last point of thePnts3d.
84 Standard_EXPORT Select3D_SensitiveCircle (const Handle(SelectBasics_EntityOwner)& theOwnerId,
85 const TColgp_Array1OfPnt& thePnts3d,
86 const Standard_Boolean theIsFilled = Standard_False);
87
88 //! Checks whether the circle overlaps current selecting volume
89 Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
90 SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
91
92
93 Standard_EXPORT void ArrayBounds (Standard_Integer & theLow, Standard_Integer & theUp) const;
94
95 Standard_EXPORT gp_Pnt GetPoint3d (const Standard_Integer thePntIdx) const;
96
97 Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) GetConnected() Standard_OVERRIDE;
98
99 //! Returns center of the circle. If location
100 //! transformation is set, it will be applied
101 Standard_EXPORT virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE;
102
103 //! Builds BVH tree for a circle's edge segments if needed
104 Standard_EXPORT virtual void BVH() Standard_OVERRIDE;
105
106 DEFINE_STANDARD_RTTI(Select3D_SensitiveCircle)
107
108private:
109
110 //! Computes myCenter3D as the barycenter of points from mypolyg3d
111 void computeCenter3D();
112
113private:
114
115 Select3D_TypeOfSensitivity mySensType; //!< True if type of selection is interior, false otherwise
116 gp_Pnt myCenter3D; //!< Center of a circle
117 Handle_Geom_Circle myCircle; //!< Points of the circle
118 Standard_Real myStart; //!< Sensitive arc parameter
119 Standard_Real myEnd; //!< Sensitive arc parameter
120};
121
122DEFINE_STANDARD_HANDLE(Select3D_SensitiveCircle, Select3D_SensitivePoly)
123
124#endif // _Select3D_SensitiveCircle_HeaderFile