|
||||
File indexing completed on 2025-01-18 10:04:53
0001 // Created on: 1995-02-16 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 _SelectMgr_Selection_HeaderFile 0018 #define _SelectMgr_Selection_HeaderFile 0019 0020 #include <SelectMgr_SensitiveEntity.hxx> 0021 #include <SelectMgr_StateOfSelection.hxx> 0022 #include <SelectMgr_TypeOfBVHUpdate.hxx> 0023 #include <SelectMgr_TypeOfUpdate.hxx> 0024 0025 class Select3D_SensitiveEntity; 0026 0027 //! Represents the state of a given selection mode for a 0028 //! Selectable Object. Contains all the sensitive entities available for this mode. 0029 //! An interactive object can have an indefinite number of 0030 //! modes of selection, each representing a 0031 //! "decomposition" into sensitive primitives; each 0032 //! primitive has an Owner (SelectMgr_EntityOwner) 0033 //! which allows us to identify the exact entity which has 0034 //! been detected. Each Selection mode is identified by 0035 //! an index. The set of sensitive primitives which 0036 //! correspond to a given mode is stocked in a 0037 //! SelectMgr_Selection object. By Convention, the 0038 //! default selection mode which allows us to grasp the 0039 //! Interactive object in its entirety will be mode 0. 0040 //! AIS_Trihedron : 4 selection modes 0041 //! - mode 0 : selection of a trihedron 0042 //! - mode 1 : selection of the origin of the trihedron 0043 //! - mode 2 : selection of the axes 0044 //! - mode 3 : selection of the planes XOY, YOZ, XOZ 0045 //! when you activate one of modes 1 2 3 4 , you pick AIS objects of type: 0046 //! - AIS_Point 0047 //! - AIS_Axis (and information on the type of axis) 0048 //! - AIS_Plane (and information on the type of plane). 0049 //! AIS_PlaneTrihedron offers 3 selection modes: 0050 //! - mode 0 : selection of the whole trihedron 0051 //! - mode 1 : selection of the origin of the trihedron 0052 //! - mode 2 : selection of the axes - same remarks as for the Trihedron. 0053 //! AIS_Shape : 7 maximum selection modes, depending 0054 //! on the complexity of the shape : 0055 //! - mode 0 : selection of the AIS_Shape 0056 //! - mode 1 : selection of the vertices 0057 //! - mode 2 : selection of the edges 0058 //! - mode 3 : selection of the wires 0059 //! - mode 4 : selection of the faces 0060 //! - mode 5 : selection of the shells 0061 //! - mode 6 : selection of the constituent solids. 0062 class SelectMgr_Selection : public Standard_Transient 0063 { 0064 DEFINE_STANDARD_RTTIEXT(SelectMgr_Selection, Standard_Transient) 0065 public: 0066 0067 //! Constructs a selection object defined by the selection mode IdMode. 0068 //! The default setting 0 is the selection mode for a shape in its entirety. 0069 Standard_EXPORT SelectMgr_Selection (const Standard_Integer theModeIdx = 0); 0070 0071 Standard_EXPORT ~SelectMgr_Selection(); 0072 0073 Standard_EXPORT void Destroy(); 0074 0075 //! Adds the sensitive primitive to the list of stored entities in this object. 0076 //! Raises NullObject if the primitive is a null handle. 0077 Standard_EXPORT void Add (const Handle(Select3D_SensitiveEntity)& theSensitive); 0078 0079 //! empties the selection from all the stored entities 0080 Standard_EXPORT void Clear(); 0081 0082 //! returns true if no sensitive entity is stored. 0083 Standard_Boolean IsEmpty() const { return myEntities.IsEmpty(); } 0084 0085 //! returns the selection mode represented by this selection 0086 Standard_Integer Mode() const { return myMode; } 0087 0088 //! Return entities. 0089 const NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>& Entities() const { return myEntities; } 0090 0091 //! Return entities. 0092 NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>& ChangeEntities() { return myEntities; } 0093 0094 //! Returns the flag UpdateFlag. 0095 //! This flage gives the update status of this framework 0096 //! in a ViewerSelector object: 0097 //! - full 0098 //! - partial, or 0099 //! - none. 0100 SelectMgr_TypeOfUpdate UpdateStatus() const { return myUpdateStatus; } 0101 0102 void UpdateStatus (const SelectMgr_TypeOfUpdate theStatus) { myUpdateStatus = theStatus; } 0103 0104 void UpdateBVHStatus (const SelectMgr_TypeOfBVHUpdate theStatus) { myBVHUpdateStatus = theStatus; } 0105 0106 SelectMgr_TypeOfBVHUpdate BVHUpdateStatus() const { return myBVHUpdateStatus; } 0107 0108 //! Returns status of selection 0109 SelectMgr_StateOfSelection GetSelectionState() const { return mySelectionState; } 0110 0111 //! Sets status of selection 0112 void SetSelectionState (const SelectMgr_StateOfSelection theState) const { mySelectionState = theState; } 0113 0114 //! Returns sensitivity of the selection 0115 Standard_Integer Sensitivity() const { return mySensFactor; } 0116 0117 //! Changes sensitivity of the selection and all its entities to the given value. 0118 //! IMPORTANT: This method does not update any outer selection structures, so for 0119 //! proper updates use SelectMgr_SelectionManager::SetSelectionSensitivity method. 0120 Standard_EXPORT void SetSensitivity (const Standard_Integer theNewSens); 0121 0122 //! Dumps the content of me into the stream 0123 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; 0124 0125 private: 0126 0127 NCollection_Vector<Handle(SelectMgr_SensitiveEntity)> myEntities; 0128 Standard_Integer myMode; 0129 SelectMgr_TypeOfUpdate myUpdateStatus; 0130 mutable SelectMgr_StateOfSelection mySelectionState; 0131 mutable SelectMgr_TypeOfBVHUpdate myBVHUpdateStatus; 0132 Standard_Integer mySensFactor; 0133 Standard_Boolean myIsCustomSens; 0134 }; 0135 0136 DEFINE_STANDARD_HANDLE(SelectMgr_Selection, Standard_Transient) 0137 0138 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |