|
||||
File indexing completed on 2025-01-18 10:03:55
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 0061 //! Creates a SignCounter, without proper Signature 0062 //! If <withmap> is True (default), added entities are counted 0063 //! only if they are not yet recorded in the map 0064 //! Map control can be set off if the input guarantees uniqueness of data 0065 //! <withlist> is transmitted to SignatureList (option to list 0066 //! entities, not only to count them). 0067 Standard_EXPORT IFSelect_SignCounter(const Standard_Boolean withmap = Standard_True, 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, const Standard_Boolean withmap = Standard_True, const Standard_Boolean withlist = Standard_False); 0072 0073 //! Returns the Signature used to count entities. It can be null. 0074 Standard_EXPORT Handle(IFSelect_Signature) Signature() const; 0075 0076 //! Changes the control status. The map is not cleared, simply 0077 //! its use changes 0078 Standard_EXPORT void SetMap (const Standard_Boolean withmap); 0079 0080 //! Adds an entity by considering its signature, which is given by 0081 //! call to method AddSign 0082 //! Returns True if added, False if already in the map (and 0083 //! map control status set) 0084 Standard_EXPORT virtual Standard_Boolean AddEntity (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model); 0085 0086 //! Adds an entity (already filtered by Map) with its signature. 0087 //! This signature can be computed with the containing model. 0088 //! Its value is provided by the object Signature given at start, 0089 //! if no Signature is defined, it does nothing. 0090 //! 0091 //! Can be redefined (in this case, see also Sign) 0092 Standard_EXPORT virtual void AddSign (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model); 0093 0094 //! Adds a list of entities by adding each of the items 0095 Standard_EXPORT void AddList (const Handle(TColStd_HSequenceOfTransient)& list, const Handle(Interface_InterfaceModel)& model); 0096 0097 //! Adds a list of entities in the context given by the graph 0098 //! Default just call basic AddList 0099 //! Can be redefined to get a signature computed with the graph 0100 Standard_EXPORT virtual void AddWithGraph (const Handle(TColStd_HSequenceOfTransient)& list, const Interface_Graph& graph); 0101 0102 //! Adds all the entities contained in a Model 0103 Standard_EXPORT void AddModel (const Handle(Interface_InterfaceModel)& model); 0104 0105 //! Adds the result determined by a Selection from a Graph 0106 //! Remark : does not impact at all data from SetSelection & Co 0107 Standard_EXPORT void AddFromSelection (const Handle(IFSelect_Selection)& sel, const Interface_Graph& G); 0108 0109 //! Sets a Selection as input : this causes content to be cleared 0110 //! then the Selection to be ready to compute (but not immediately) 0111 Standard_EXPORT void SetSelection (const Handle(IFSelect_Selection)& sel); 0112 0113 //! Returns the selection, or a null Handle 0114 Standard_EXPORT Handle(IFSelect_Selection) Selection() const; 0115 0116 //! Changes the mode of working with the selection : 0117 //! -1 just clears optimisation data and nothing else 0118 //! 0 clears it 1 inhibits it for computing (but no clearing) 0119 //! 2 sets it active for computing 0120 //! Default at creation is 0, after SetSelection (not null) is 2 0121 Standard_EXPORT void SetSelMode (const Standard_Integer selmode); 0122 0123 //! Returns the mode of working with the selection 0124 Standard_EXPORT Standard_Integer SelMode() const; 0125 0126 //! Computes from the selection result, if selection is active 0127 //! (mode 2). If selection is not defined (mode 0) or is inhibited 0128 //! (mode 1) does nothing. 0129 //! Returns True if computation is done (or optimised), False else 0130 //! This method is called by ComputeCounter from WorkSession 0131 //! 0132 //! If <forced> is True, recomputes systematically 0133 //! Else (D), if the counter was not cleared and if the former 0134 //! computed result started from the same total size of Graph and 0135 //! same count of selected entities : computation is not redone 0136 //! unless <forced> is given as True 0137 Standard_EXPORT Standard_Boolean ComputeSelected (const Interface_Graph& G, const Standard_Boolean forced = Standard_False); 0138 0139 //! Determines and returns the value of the signature for an 0140 //! entity as an HAsciiString. This method works exactly as 0141 //! AddSign, which is optimized 0142 //! 0143 //! Can be redefined, accorded with AddSign 0144 Standard_EXPORT virtual Handle(TCollection_HAsciiString) Sign (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const; 0145 0146 //! Applies AddWithGraph on one entity, and returns the Signature 0147 //! Value which has been recorded 0148 //! To do this, Add is called with SignOnly Mode True during the 0149 //! call, the returned value is LastValue 0150 Standard_EXPORT Standard_CString ComputedSign (const Handle(Standard_Transient)& ent, const Interface_Graph& G); 0151 0152 DEFINE_STANDARD_RTTIEXT(IFSelect_SignCounter,IFSelect_SignatureList) 0153 0154 private: 0155 0156 Standard_Boolean themapstat; 0157 TColStd_MapOfTransient themap; 0158 Handle(IFSelect_Signature) thematcher; 0159 Handle(IFSelect_Selection) theselect; 0160 Standard_Integer theselmode; 0161 Standard_Integer thenbcomp1; 0162 Standard_Integer thenbcomp2; 0163 0164 }; 0165 0166 #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 |