Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:52

0001 // Created on: 2014-08-15
0002 // Created by: Varvara POSKONINA
0003 // Copyright (c) 2005-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _Select3D_InteriorSensitivePointSet_HeaderFile
0017 #define _Select3D_InteriorSensitivePointSet_HeaderFile
0018 
0019 #include <Select3D_SensitivePoly.hxx>
0020 #include <Select3D_SensitiveSet.hxx>
0021 
0022 class SelectMgr_EntityOwner;
0023 
0024 typedef NCollection_Vector<Handle(Select3D_SensitivePoly)> Select3D_VectorOfHPoly;
0025 
0026 //! This class handles the selection of arbitrary point set with internal type of sensitivity.
0027 //! The main principle is to split the point set given onto planar convex polygons and search
0028 //! for the overlap with one or more of them through traverse of BVH tree.
0029 class Select3D_InteriorSensitivePointSet : public Select3D_SensitiveSet
0030 {
0031 public:
0032 
0033   //! Splits the given point set thePoints onto planar convex polygons
0034   Standard_EXPORT Select3D_InteriorSensitivePointSet (const Handle(SelectMgr_EntityOwner)& theOwnerId,
0035                                                       const TColgp_Array1OfPnt& thePoints);
0036 
0037   //! Initializes the given array theHArrayOfPnt by 3d coordinates of vertices of the
0038   //! whole point set
0039   Standard_EXPORT virtual void GetPoints (Handle(TColgp_HArray1OfPnt)& theHArrayOfPnt);
0040 
0041   //! Returns the length of vector of planar convex polygons
0042   Standard_EXPORT virtual Standard_Integer Size() const Standard_OVERRIDE;
0043 
0044   //! Returns bounding box of planar convex polygon with index theIdx
0045   Standard_EXPORT virtual Select3D_BndBox3d Box (const Standard_Integer theIdx) const Standard_OVERRIDE;
0046 
0047   //! Returns geometry center of planar convex polygon with index
0048   //! theIdx in the vector along the given axis theAxis
0049   Standard_EXPORT virtual Standard_Real Center (const Standard_Integer theIdx,
0050                                                 const Standard_Integer theAxis) const Standard_OVERRIDE;
0051 
0052   //! Swaps items with indexes theIdx1 and theIdx2 in the vector
0053   Standard_EXPORT virtual void Swap (const Standard_Integer theIdx1,
0054                                      const Standard_Integer theIdx2) Standard_OVERRIDE;
0055 
0056   //! Returns bounding box of the point set. If location
0057   //! transformation is set, it will be applied
0058   Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
0059 
0060   //! Returns center of the point set. If location
0061   //! transformation is set, it will be applied
0062   Standard_EXPORT virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE;
0063 
0064   //! Returns the amount of points in set
0065   Standard_EXPORT virtual Standard_Integer NbSubElements() const Standard_OVERRIDE;
0066 
0067   //! Dumps the content of me into the stream
0068   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
0069 
0070   DEFINE_STANDARD_RTTIEXT(Select3D_InteriorSensitivePointSet,Select3D_SensitiveSet)
0071 
0072 protected:
0073 
0074   //! Checks whether the planar convex polygon with index theIdx
0075   //! in myPlanarPolygons overlaps the current selecting volume
0076   Standard_EXPORT virtual Standard_Boolean overlapsElement (SelectBasics_PickResult& thePickResult,
0077                                                             SelectBasics_SelectingVolumeManager& theMgr,
0078                                                             Standard_Integer theElemIdx,
0079                                                             Standard_Boolean theIsFullInside) Standard_OVERRIDE;
0080 
0081   //! Checks whether the entity with index theIdx is inside the current selecting volume
0082   Standard_EXPORT virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
0083                                                             Standard_Integer theElemIdx,
0084                                                             Standard_Boolean theIsFullInside) Standard_OVERRIDE;
0085 
0086   //! Calculates distance from the 3d projection of used-picked
0087   //! screen point to center of the geometry
0088   Standard_EXPORT virtual Standard_Real distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) Standard_OVERRIDE;
0089 
0090 protected:
0091 
0092   Select3D_VectorOfHPoly          myPlanarPolygons;     //!< Vector of planar polygons
0093   Handle(TColStd_HArray1OfInteger) myPolygonsIdxs;       //!< Indexes array for BVH calculation
0094   gp_Pnt                          myCOG;                //!< Center of the point set
0095   Select3D_BndBox3d               myBndBox;             //!< Bounding box of the point set
0096 };
0097 
0098 DEFINE_STANDARD_HANDLE(Select3D_InteriorSensitivePointSet, Select3D_SensitiveSet)
0099 
0100 #endif // _Select3D_InteriorSensitivePointSet_HeaderFile