0031322: Visualization, Select3D_SensitiveEntity - method NbSubElements() should...
[occt.git] / src / MeshVS / MeshVS_SensitivePolyhedron.hxx
1 // Created on: 2005-01-21
2 // Created by: Alexander SOLOVYOV
3 // Copyright (c) 2005-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #ifndef _MeshVS_SensitivePolyhedron_HeaderFile
17 #define _MeshVS_SensitivePolyhedron_HeaderFile
18
19 #include <Standard.hxx>
20 #include <Standard_Type.hxx>
21
22 #include <TColgp_HArray1OfPnt.hxx>
23 #include <TColgp_HArray1OfPnt2d.hxx>
24 #include <MeshVS_HArray1OfSequenceOfInteger.hxx>
25 #include <gp_XY.hxx>
26 #include <NCollection_List.hxx>
27 #include <Select3D_SensitiveEntity.hxx>
28 #include <Select3D_SensitiveEntity.hxx>
29 #include <Select3D_BndBox3d.hxx>
30
31 class Select3D_SensitiveEntity;
32 class TopLoc_Location;
33 class Bnd_Box2d;
34 class gp_Lin;
35 class SelectBasics_ListOfBox2d;
36
37 typedef NCollection_List<Handle(TColgp_HArray1OfPnt)> MeshVS_PolyhedronVerts;
38 typedef NCollection_List<Handle(TColgp_HArray1OfPnt)>::Iterator MeshVS_PolyhedronVertsIter;
39
40 //! This class is used to detect selection of a polyhedron. The main
41 //! principle of detection algorithm is to search for overlap with
42 //! each polyhedron's face separately, treating them as planar convex
43 //! polygons.
44 class MeshVS_SensitivePolyhedron : public Select3D_SensitiveEntity
45 {
46 public:
47
48   Standard_EXPORT MeshVS_SensitivePolyhedron (const Handle(SelectMgr_EntityOwner)& theOwner,
49                                               const TColgp_Array1OfPnt& theNodes,
50                                               const Handle(MeshVS_HArray1OfSequenceOfInteger)& theTopo);
51
52   Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) GetConnected() Standard_OVERRIDE;
53
54   Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
55                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
56
57   //! Returns the amount of nodes of polyhedron
58   Standard_EXPORT virtual Standard_Integer NbSubElements() const Standard_OVERRIDE;
59
60   Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
61
62   Standard_EXPORT virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE;
63
64   DEFINE_STANDARD_RTTIEXT(MeshVS_SensitivePolyhedron,Select3D_SensitiveEntity)
65
66 private:
67
68   MeshVS_PolyhedronVerts myTopology;
69   gp_XYZ myCenter;
70   Select3D_BndBox3d myBndBox;
71   Handle(TColgp_HArray1OfPnt) myNodes;
72   Handle(MeshVS_HArray1OfSequenceOfInteger) myTopo;
73 };
74
75 DEFINE_STANDARD_HANDLE(MeshVS_SensitivePolyhedron, Select3D_SensitiveEntity)
76
77 #endif // _MeshVS_SensitivePolyhedron_HeaderFile