|
|
|||
File indexing completed on 2026-05-31 08:30:29
0001 // Created on: 1994-11-07 0002 // Created by: Christian CAILLET 0003 // Copyright (c) 1994-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 _IFSelect_SignCounter_HeaderFile 0018 #define _IFSelect_SignCounter_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_Type.hxx> 0022 0023 #include <TColStd_MapOfTransient.hxx> 0024 #include <Standard_Integer.hxx> 0025 #include <IFSelect_SignatureList.hxx> 0026 #include <TColStd_HSequenceOfTransient.hxx> 0027 class IFSelect_Signature; 0028 class IFSelect_Selection; 0029 class Standard_Transient; 0030 class Interface_InterfaceModel; 0031 class Interface_Graph; 0032 class TCollection_HAsciiString; 0033 0034 class IFSelect_SignCounter; 0035 DEFINE_STANDARD_HANDLE(IFSelect_SignCounter, IFSelect_SignatureList) 0036 0037 //! SignCounter gives the frame to count signatures associated 0038 //! with entities, deducted from them. Ex.: their Dynamic Type. 0039 //! 0040 //! It can sort a set of Entities according a signature, i.e. : 0041 //! - list of different values found for this Signature 0042 //! - for each one, count and list of entities 0043 //! Results are returned as a SignatureList, which can be queried 0044 //! on the count (list of strings, count per signature, or list of 0045 //! entities per signature) 0046 //! 0047 //! A SignCounter can be filled, either directly from lists, or 0048 //! from the result of a Selection : hence, its content can be 0049 //! automatically recomputed as desired 0050 //! 0051 //! SignCounter works by using a Signature in its method AddSign 0052 //! 0053 //! Methods can be redefined to, either 0054 //! - directly compute the value without a Signature 0055 //! - compute the value in the context of a Graph 0056 class IFSelect_SignCounter : public IFSelect_SignatureList 0057 { 0058 0059 public: 0060 //! Creates a SignCounter, without proper Signature 0061 //! If <withmap> is True (default), added entities are counted 0062 //! only if they are not yet recorded in the map 0063 //! Map control can be set off if the input guarantees uniqueness of data 0064 //! <withlist> is transmitted to SignatureList (option to list 0065 //! entities, not only to count them). 0066 Standard_EXPORT IFSelect_SignCounter(const Standard_Boolean withmap = Standard_True, 0067 const Standard_Boolean withlist = Standard_False); 0068 0069 //! Creates a SignCounter, with a predefined Signature 0070 //! Other arguments as for Create without Signature. 0071 Standard_EXPORT IFSelect_SignCounter(const Handle(IFSelect_Signature)& matcher, 0072 const Standard_Boolean withmap = Standard_True, 0073 const Standard_Boolean withlist = Standard_False); 0074 0075 //! Returns the Signature used to count entities. It can be null. 0076 Standard_EXPORT Handle(IFSelect_Signature) Signature() const; 0077 0078 //! Changes the control status. The map is not cleared, simply 0079 //! its use changes 0080 Standard_EXPORT void SetMap(const Standard_Boolean withmap); 0081 0082 //! Adds an entity by considering its signature, which is given by 0083 //! call to method AddSign 0084 //! Returns True if added, False if already in the map (and 0085 //! map control status set) 0086 Standard_EXPORT virtual Standard_Boolean AddEntity(const Handle(Standard_Transient)& ent, 0087 const Handle(Interface_InterfaceModel)& model); 0088 0089 //! Adds an entity (already filtered by Map) with its signature. 0090 //! This signature can be computed with the containing model. 0091 //! Its value is provided by the object Signature given at start, 0092 //! if no Signature is defined, it does nothing. 0093 //! 0094 //! Can be redefined (in this case, see also Sign) 0095 Standard_EXPORT virtual void AddSign(const Handle(Standard_Transient)& ent, 0096 const Handle(Interface_InterfaceModel)& model); 0097 0098 //! Adds a list of entities by adding each of the items 0099 Standard_EXPORT void AddList(const Handle(TColStd_HSequenceOfTransient)& list, 0100 const Handle(Interface_InterfaceModel)& model); 0101 0102 //! Adds a list of entities in the context given by the graph 0103 //! Default just call basic AddList 0104 //! Can be redefined to get a signature computed with the graph 0105 Standard_EXPORT virtual void AddWithGraph(const Handle(TColStd_HSequenceOfTransient)& list, 0106 const Interface_Graph& graph); 0107 0108 //! Adds all the entities contained in a Model 0109 Standard_EXPORT void AddModel(const Handle(Interface_InterfaceModel)& model); 0110 0111 //! Adds the result determined by a Selection from a Graph 0112 //! Remark : does not impact at all data from SetSelection & Co 0113 Standard_EXPORT void AddFromSelection(const Handle(IFSelect_Selection)& sel, 0114 const Interface_Graph& G); 0115 0116 //! Sets a Selection as input : this causes content to be cleared 0117 //! then the Selection to be ready to compute (but not immediately) 0118 Standard_EXPORT void SetSelection(const Handle(IFSelect_Selection)& sel); 0119 0120 //! Returns the selection, or a null Handle 0121 Standard_EXPORT Handle(IFSelect_Selection) Selection() const; 0122 0123 //! Changes the mode of working with the selection : 0124 //! -1 just clears optimisation data and nothing else 0125 //! 0 clears it 1 inhibits it for computing (but no clearing) 0126 //! 2 sets it active for computing 0127 //! Default at creation is 0, after SetSelection (not null) is 2 0128 Standard_EXPORT void SetSelMode(const Standard_Integer selmode); 0129 0130 //! Returns the mode of working with the selection 0131 Standard_EXPORT Standard_Integer SelMode() const; 0132 0133 //! Computes from the selection result, if selection is active 0134 //! (mode 2). If selection is not defined (mode 0) or is inhibited 0135 //! (mode 1) does nothing. 0136 //! Returns True if computation is done (or optimised), False else 0137 //! This method is called by ComputeCounter from WorkSession 0138 //! 0139 //! If <forced> is True, recomputes systematically 0140 //! Else (D), if the counter was not cleared and if the former 0141 //! computed result started from the same total size of Graph and 0142 //! same count of selected entities : computation is not redone 0143 //! unless <forced> is given as True 0144 Standard_EXPORT Standard_Boolean ComputeSelected(const Interface_Graph& G, 0145 const Standard_Boolean forced = Standard_False); 0146 0147 //! Determines and returns the value of the signature for an 0148 //! entity as an HAsciiString. This method works exactly as 0149 //! AddSign, which is optimized 0150 //! 0151 //! Can be redefined, accorded with AddSign 0152 Standard_EXPORT virtual Handle(TCollection_HAsciiString) Sign( 0153 const Handle(Standard_Transient)& ent, 0154 const Handle(Interface_InterfaceModel)& model) const; 0155 0156 //! Applies AddWithGraph on one entity, and returns the Signature 0157 //! Value which has been recorded 0158 //! To do this, Add is called with SignOnly Mode True during the 0159 //! call, the returned value is LastValue 0160 Standard_EXPORT Standard_CString ComputedSign(const Handle(Standard_Transient)& ent, 0161 const Interface_Graph& G); 0162 0163 DEFINE_STANDARD_RTTIEXT(IFSelect_SignCounter, IFSelect_SignatureList) 0164 0165 private: 0166 Standard_Boolean themapstat; 0167 TColStd_MapOfTransient themap; 0168 Handle(IFSelect_Signature) thematcher; 0169 Handle(IFSelect_Selection) theselect; 0170 Standard_Integer theselmode; 0171 Standard_Integer thenbcomp1; 0172 Standard_Integer thenbcomp2; 0173 }; 0174 0175 #endif // _IFSelect_SignCounter_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|