|
|
|||
File indexing completed on 2026-09-16 09:18:33
0001 // Created on: 1995-03-08 0002 // Created by: Mister rmi 0003 // Copyright (c) 1995-1999 Matra Datavision 0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS 0005 // 0006 // This file is part of Open CASCADE Technology software library. 0007 // 0008 // This library is free software; you can redistribute it and/or modify it under 0009 // the terms of the GNU Lesser General Public License version 2.1 as published 0010 // by the Free Software Foundation, with special exception defined in the file 0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0012 // distribution for complete text of the license and disclaimer of any warranty. 0013 // 0014 // Alternatively, this file may be used under the terms of Open CASCADE 0015 // commercial license or contractual agreement. 0016 0017 #ifndef _StdSelect_BRepSelectionTool_HeaderFile 0018 #define _StdSelect_BRepSelectionTool_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_DefineAlloc.hxx> 0022 #include <Standard_Handle.hxx> 0023 0024 #include <SelectMgr_Selection.hxx> 0025 #include <Standard_Real.hxx> 0026 #include <Standard_Boolean.hxx> 0027 #include <Standard_Integer.hxx> 0028 #include <Select3D_SensitiveEntity.hxx> 0029 #include <NCollection_Sequence.hxx> 0030 #include <StdSelect_BRepOwner.hxx> 0031 #include <TopTools_ShapeMapHasher.hxx> 0032 #include <NCollection_IndexedMap.hxx> 0033 0034 class Select3D_SensitiveEntity; 0035 class SelectMgr_SelectableObject; 0036 class TopoDS_Face; 0037 0038 //! Tool to create specific selections (sets of primitives) 0039 //! for Shapes from Topology. 0040 //! These Selections may be used in dynamic selection 0041 //! Mechanism 0042 //! Given a Shape and a mode of selection 0043 //! (selection of vertices, 0044 //! edges,faces ...) , This Tool Computes corresponding sensitive primitives, 0045 //! puts them in an entity called Selection (see package SelectMgr) and returns it. 0046 //! 0047 //! A Priority for the decomposed pickable objects can be given ; 0048 //! by default There is A Preset Hierarchy: 0049 //! Vertex priority : 5 0050 //! Edge priority : 4 0051 //! Wire priority : 3 0052 //! Face priority : 2 0053 //! Shell,solid,shape priority : 1 0054 //! the default priority in the following methods has no sense - it's only taken in account 0055 //! when the user gives a value between 0 and 10. 0056 //! IMPORTANT : This decomposition creates BRepEntityOwner instances (from StdSelect). 0057 //! which are stored in the Sensitive Entities coming from The Decomposition. 0058 //! 0059 //! the result of picking in a ViewerSelector return EntityOwner from SelectMgr; 0060 //! to know what kind of object was picked : 0061 //! 0062 //! ENTITY_OWNER -> Selectable() gives the selectableobject which 0063 //! was decomposed into pickable elements. 0064 //! occ::down_cast<StdSelect_BRepOwner>(ENTITY_OWNER) -> Shape() 0065 //! gives the real picked shape (edge,vertex,shape...) 0066 class StdSelect_BRepSelectionTool 0067 { 0068 public: 0069 DEFINE_STANDARD_ALLOC 0070 0071 //! Decomposition of <aShape> into sensitive entities following 0072 //! a mode of decomposition <aType>. These entities are stored in <aSelection>. 0073 //! BrepOwners are created to store the identity of the picked shapes 0074 //! during the selection process. 0075 //! In those BRepOwners is also stored the original shape. 0076 //! But One can't get the selectable object which was decomposed to give 0077 //! the sensitive entities. 0078 //! maximal parameter is used for infinite objects, to limit the sensitive Domain.... 0079 //! If AutoTriangulation = True, a Triangulation will be 0080 //! computed for faces which have no existing one. 0081 //! if AutoTriangulation = False the old algorithm will be 0082 //! called to compute sensitive entities on faces. 0083 Standard_EXPORT static void Load(const occ::handle<SelectMgr_Selection>& aSelection, 0084 const TopoDS_Shape& aShape, 0085 const TopAbs_ShapeEnum aType, 0086 const double theDeflection, 0087 const double theDeviationAngle, 0088 const bool AutoTriangulation = true, 0089 const int aPriority = -1, 0090 const int NbPOnEdge = 9, 0091 const double MaximalParameter = 500); 0092 0093 //! Same functionalities. The only 0094 //! difference is that the selectable object from which the 0095 //! selection comes is stored in each Sensitive EntityOwner; 0096 //! decomposition of <aShape> into sensitive entities following 0097 //! a mode of decomposition <aType>. These entities are stored in <aSelection> 0098 //! The Major difference is that the known users are first inserted in the 0099 //! BRepOwners. the original shape is the last user... 0100 //! (see EntityOwner from SelectBasics and BrepOwner)... 0101 Standard_EXPORT static void Load(const occ::handle<SelectMgr_Selection>& aSelection, 0102 const occ::handle<SelectMgr_SelectableObject>& Origin, 0103 const TopoDS_Shape& aShape, 0104 const TopAbs_ShapeEnum aType, 0105 const double theDeflection, 0106 const double theDeviationAngle, 0107 const bool AutoTriangulation = true, 0108 const int aPriority = -1, 0109 const int NbPOnEdge = 9, 0110 const double MaximalParameter = 500); 0111 0112 //! Returns the standard priority of the shape aShap having the type aType. 0113 //! This priority is passed to a StdSelect_BRepOwner object. 0114 //! You can use the function Load to modify the 0115 //! selection priority of an owner to make one entity 0116 //! more selectable than another one. 0117 static int GetStandardPriority(const TopoDS_Shape& theShape, const TopAbs_ShapeEnum theType) 0118 { 0119 switch (theType) 0120 { 0121 case TopAbs_VERTEX: 0122 return 8; 0123 case TopAbs_EDGE: 0124 return 7; 0125 case TopAbs_WIRE: 0126 return 6; 0127 case TopAbs_FACE: 0128 return 5; 0129 case TopAbs_SHAPE: 0130 default: 0131 break; 0132 } 0133 0134 switch (theShape.ShapeType()) 0135 { 0136 case TopAbs_VERTEX: 0137 return 9; 0138 case TopAbs_EDGE: 0139 return 8; 0140 case TopAbs_WIRE: 0141 return 7; 0142 case TopAbs_FACE: 0143 return 6; 0144 case TopAbs_SHELL: 0145 return 5; 0146 case TopAbs_COMPOUND: 0147 case TopAbs_COMPSOLID: 0148 case TopAbs_SOLID: 0149 case TopAbs_SHAPE: 0150 default: 0151 return 4; 0152 } 0153 } 0154 0155 //! Computes the sensitive primitives, stores them in the SelectMgr_Selection object, and returns 0156 //! this object. 0157 //! @param[in] theShape shape to compute sensitive entities 0158 //! @param[in] theOwner selectable owner object 0159 //! @param[in] theSelection selection to append new sensitive entities 0160 //! @param[in] theDeflection linear deflection 0161 //! @param[in] theDeflAngle angular deflection 0162 //! @param[in] theNbPOnEdge sensitivity parameters for edges and wires 0163 //! @param[in] theMaxiParam sensitivity parameters for infinite objects (the default value is 0164 //! 500) 0165 //! @param[in] theAutoTriang flag to compute triangulation for the faces which have none 0166 Standard_EXPORT static void ComputeSensitive(const TopoDS_Shape& theShape, 0167 const occ::handle<SelectMgr_EntityOwner>& theOwner, 0168 const occ::handle<SelectMgr_Selection>& theSelection, 0169 const double theDeflection, 0170 const double theDeflAngle, 0171 const int theNbPOnEdge, 0172 const double theMaxiParam, 0173 const bool theAutoTriang = true); 0174 0175 //! Creates the 3D sensitive entities for Face selection. 0176 //! @param[in] theFace face to compute sensitive entities 0177 //! @param[in] theOwner selectable owner object 0178 //! @param[out] theOutList output result list to append created entities 0179 //! @param[in] theAutoTriang obsolete flag (has no effect) 0180 //! @param[in] theNbPOnEdge sensitivity parameters 0181 //! @param[in] theMaxiParam sensitivity parameters 0182 //! @param[in] theInteriorFlag flag indicating that face interior (TRUE) or face boundary (FALSE) 0183 //! should be selectable 0184 Standard_EXPORT static bool GetSensitiveForFace( 0185 const TopoDS_Face& theFace, 0186 const occ::handle<SelectMgr_EntityOwner>& theOwner, 0187 NCollection_Sequence<occ::handle<Select3D_SensitiveEntity>>& theOutList, 0188 const bool theAutoTriang = true, 0189 const int theNbPOnEdge = 9, 0190 const double theMaxiParam = 500, 0191 const bool theInteriorFlag = true); 0192 0193 //! Creates a sensitive cylinder. 0194 //! @param[in] theSubfacesMap map of cylinder faces 0195 //! @param[in] theOwner selectable owner object 0196 //! @param[in] theSelection selection to append new sensitive entities 0197 Standard_EXPORT static bool GetSensitiveForCylinder( 0198 const NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>& theSubfacesMap, 0199 const occ::handle<SelectMgr_EntityOwner>& theOwner, 0200 const occ::handle<SelectMgr_Selection>& theSelection); 0201 0202 //! Create a sensitive edge or sensitive wire. 0203 //! @param[in] theShape either TopoDS_Edge or TopoDS_Wire to compute sensitive entities 0204 //! @param[in] theOwner selectable owner object 0205 //! @param[in] theSelection selection to append new sensitive entities 0206 //! @param[in] theDeflection linear deflection 0207 //! @param[in] theDeviationAngle angular deflection 0208 //! @param[in] theNbPOnEdge sensitivity parameters 0209 //! @param[out] theMaxiParam sensitivity parameters 0210 Standard_EXPORT static void GetEdgeSensitive(const TopoDS_Shape& theShape, 0211 const occ::handle<SelectMgr_EntityOwner>& theOwner, 0212 const occ::handle<SelectMgr_Selection>& theSelection, 0213 const double theDeflection, 0214 const double theDeviationAngle, 0215 const int theNbPOnEdge, 0216 const double theMaxiParam, 0217 occ::handle<Select3D_SensitiveEntity>& theSensitive); 0218 0219 //! Traverses the selection given and pre-builds BVH trees for heavyweight 0220 //! sensitive entities containing more than BVH_PRIMITIVE_LIMIT (defined in .cxx file) 0221 //! sub-elements. 0222 Standard_EXPORT static void PreBuildBVH(const occ::handle<SelectMgr_Selection>& theSelection); 0223 }; 0224 0225 #endif // _StdSelect_BRepSelectionTool_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|