0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / src / Select3D / Select3D_InteriorSensitivePointSet.hxx
CommitLineData
f751596e 1// Created on: 2014-08-15
2// Created by: Varvara POSKONINA
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 _Select3D_InteriorSensitivePointSet_HeaderFile
17#define _Select3D_InteriorSensitivePointSet_HeaderFile
18
19#include <NCollection_Vector.hxx>
20
b7c077b9 21#include <TColgp_HArray1OfPnt.hxx>
22#include <TColStd_HArray1OfInteger.hxx>
f751596e 23
f751596e 24#include <Select3D_SensitivePoly.hxx>
25#include <Select3D_SensitiveSet.hxx>
26
27class gp_Pnt;
0ef04197 28class SelectMgr_EntityOwner;
f751596e 29
30typedef NCollection_Vector<Handle(Select3D_SensitivePoly)> Select3D_VectorOfHPoly;
31
32//! This class handles the selection of arbitrary point set with internal type of sensitivity.
33//! The main principle is to split the point set given onto planar convex polygons and search
34//! for the overlap with one or more of them through traverse of BVH tree.
bf3977c9 35class Select3D_InteriorSensitivePointSet : public Select3D_SensitiveSet
f751596e 36{
37public:
38
39 //! Splits the given point set thePoints onto planar convex polygons
0ef04197 40 Standard_EXPORT Select3D_InteriorSensitivePointSet (const Handle(SelectMgr_EntityOwner)& theOwnerId,
f751596e 41 const TColgp_Array1OfPnt& thePoints);
42
f751596e 43 //! Initializes the given array theHArrayOfPnt by 3d coordinates of vertices of the
44 //! whole point set
bf3977c9 45 Standard_EXPORT virtual void GetPoints (Handle(TColgp_HArray1OfPnt)& theHArrayOfPnt);
f751596e 46
47 //! Returns the length of vector of planar convex polygons
48 Standard_EXPORT virtual Standard_Integer Size() const Standard_OVERRIDE;
49
50 //! Returns bounding box of planar convex polygon with index theIdx
51 Standard_EXPORT virtual Select3D_BndBox3d Box (const Standard_Integer theIdx) const Standard_OVERRIDE;
52
53 //! Returns geometry center of planar convex polygon with index
54 //! theIdx in the vector along the given axis theAxis
55 Standard_EXPORT virtual Standard_Real Center (const Standard_Integer theIdx,
56 const Standard_Integer theAxis) const Standard_OVERRIDE;
57
58 //! Swaps items with indexes theIdx1 and theIdx2 in the vector
59 Standard_EXPORT virtual void Swap (const Standard_Integer theIdx1,
60 const Standard_Integer theIdx2) Standard_OVERRIDE;
61
62 //! Returns bounding box of the point set. If location
63 //! transformation is set, it will be applied
64 Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
65
66 //! Returns center of the point set. If location
67 //! transformation is set, it will be applied
68 Standard_EXPORT virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE;
69
f751596e 70 //! Returns the amount of points in set
fe758dbe 71 Standard_EXPORT virtual Standard_Integer NbSubElements() const Standard_OVERRIDE;
f751596e 72
bc73b006 73 //! Dumps the content of me into the stream
74 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
75
92efcf78 76 DEFINE_STANDARD_RTTIEXT(Select3D_InteriorSensitivePointSet,Select3D_SensitiveSet)
bf3977c9 77
f751596e 78protected:
79
80 //! Checks whether the planar convex polygon with index theIdx
81 //! in myPlanarPolygons overlaps the current selecting volume
4a056d20 82 Standard_EXPORT virtual Standard_Boolean overlapsElement (SelectBasics_PickResult& thePickResult,
83 SelectBasics_SelectingVolumeManager& theMgr,
f751596e 84 Standard_Integer theElemIdx,
4a056d20 85 Standard_Boolean theIsFullInside) Standard_OVERRIDE;
f751596e 86
2157d6ac 87 //! Checks whether the entity with index theIdx is inside the current selecting volume
88 Standard_EXPORT virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
4a056d20 89 Standard_Integer theElemIdx,
90 Standard_Boolean theIsFullInside) Standard_OVERRIDE;
2157d6ac 91
f751596e 92 //! Calculates distance from the 3d projection of used-picked
93 //! screen point to center of the geometry
94 Standard_EXPORT virtual Standard_Real distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) Standard_OVERRIDE;
95
96protected:
97
98 Select3D_VectorOfHPoly myPlanarPolygons; //!< Vector of planar polygons
35c0599a 99 Handle(TColStd_HArray1OfInteger) myPolygonsIdxs; //!< Indexes array for BVH calculation
f751596e 100 gp_Pnt myCOG; //!< Center of the point set
101 Select3D_BndBox3d myBndBox; //!< Bounding box of the point set
102};
103
bf3977c9 104DEFINE_STANDARD_HANDLE(Select3D_InteriorSensitivePointSet, Select3D_SensitiveSet)
105
f751596e 106#endif // _Select3D_InteriorSensitivePointSet_HeaderFile