|
||||
File indexing completed on 2025-01-18 10:03:53
0001 // Created on: 1994-06-08 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_ContextModif_HeaderFile 0018 #define _IFSelect_ContextModif_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_DefineAlloc.hxx> 0022 #include <Standard_Handle.hxx> 0023 0024 #include <Interface_Graph.hxx> 0025 #include <TCollection_AsciiString.hxx> 0026 #include <Interface_CheckIterator.hxx> 0027 #include <Standard_Boolean.hxx> 0028 #include <Standard_Integer.hxx> 0029 class Interface_Protocol; 0030 class Interface_CopyControl; 0031 class Interface_CopyTool; 0032 class Interface_EntityIterator; 0033 class Interface_InterfaceModel; 0034 class Standard_Transient; 0035 class IFSelect_GeneralModifier; 0036 class Interface_Check; 0037 0038 0039 //! This class gathers various information used by Model Modifiers 0040 //! apart from the target model itself, and the CopyTool which 0041 //! must be passed directly. 0042 //! 0043 //! These information report to original data : model, entities, 0044 //! and the selection list if there is one : it allows to query 0045 //! about such or such starting entity, or result entity, or 0046 //! iterate on selection list ... 0047 //! Also data useful for file output are available (because some 0048 //! Modifiers concern models produced for file output). 0049 //! 0050 //! Furthermore, in return, ContextModif can record Checks, either 0051 //! one for all, or one for each Entity. It supports trace too. 0052 class IFSelect_ContextModif 0053 { 0054 public: 0055 0056 DEFINE_STANDARD_ALLOC 0057 0058 //! Prepares a ContextModif with these information : 0059 //! - the graph established from original model (target passed 0060 //! directly to Modifier) 0061 //! - the CopyTool which detains the CopyControl, which maps 0062 //! starting (in original) and result (in target) entities 0063 //! - an optional file name (for file output) 0064 //! 0065 //! Such a ContextModif is considered to be applied on all 0066 //! transferred entities (no filter active) 0067 Standard_EXPORT IFSelect_ContextModif(const Interface_Graph& graph, const Interface_CopyTool& TC, const Standard_CString filename = ""); 0068 0069 //! Prepares a ContextModif with these information : 0070 //! - the graph established from original model (target passed 0071 //! directly to Modifier) 0072 //! - an optional file name (for file output) 0073 //! Here, no CopyControl, hence all entities are considered equal 0074 //! as starting and result 0075 //! 0076 //! Such a ContextModif is considered to be applied on all 0077 //! transferred entities (no filter active) 0078 Standard_EXPORT IFSelect_ContextModif(const Interface_Graph& graph, const Standard_CString filename = ""); 0079 0080 //! This method requires ContextModif to be applied with a filter. 0081 //! If a ModelModifier is defined with a Selection criterium, 0082 //! the result of this Selection is used as a filter : 0083 //! - if none of its items has been transferred, the modification 0084 //! does not apply at all 0085 //! - else, the Modifier can query for what entities were selected 0086 //! and what are their results 0087 //! - if this method is not called before working, the Modifier 0088 //! has to work on the whole Model 0089 Standard_EXPORT void Select (Interface_EntityIterator& list); 0090 0091 //! Returns the original Graph (compared to OriginalModel, it 0092 //! gives more query capabilitites) 0093 Standard_EXPORT const Interface_Graph& OriginalGraph() const; 0094 0095 //! Returns the original model 0096 Standard_EXPORT Handle(Interface_InterfaceModel) OriginalModel() const; 0097 0098 //! Allows to transmit a Protocol as part of a ContextModif 0099 Standard_EXPORT void SetProtocol (const Handle(Interface_Protocol)& proto); 0100 0101 //! Returns the Protocol (Null if not set) 0102 Standard_EXPORT Handle(Interface_Protocol) Protocol() const; 0103 0104 //! Returns True if a non empty file name has been defined 0105 Standard_EXPORT Standard_Boolean HasFileName() const; 0106 0107 //! Returns File Name (can be empty) 0108 Standard_EXPORT Standard_CString FileName() const; 0109 0110 //! Returns the map for a direct use, if required 0111 Standard_EXPORT Handle(Interface_CopyControl) Control() const; 0112 0113 //! Returns True if Select has determined that a Modifier may not 0114 //! be run (filter defined and empty) 0115 Standard_EXPORT Standard_Boolean IsForNone() const; 0116 0117 //! Returns True if no filter is defined : a Modifier has to work 0118 //! on all entities of the resulting (target) model 0119 Standard_EXPORT Standard_Boolean IsForAll() const; 0120 0121 //! Returns True if a starting item has been transferred 0122 Standard_EXPORT Standard_Boolean IsTransferred (const Handle(Standard_Transient)& ent) const; 0123 0124 //! Returns True if a starting item has been transferred and selected 0125 Standard_EXPORT Standard_Boolean IsSelected (const Handle(Standard_Transient)& ent) const; 0126 0127 //! Returns True if a starting entity has been transferred, and 0128 //! the result is in <res>. Returns False else 0129 //! (direct call to the map) 0130 Standard_EXPORT Standard_Boolean Search (const Handle(Standard_Transient)& ent, Handle(Standard_Transient)& res) const; 0131 0132 //! Returns the list of original selected items. 0133 //! See also the iteration 0134 Standard_EXPORT Interface_EntityIterator SelectedOriginal() const; 0135 0136 //! Returns the list of resulting counterparts of selected items. 0137 //! See also the iteration 0138 Standard_EXPORT Interface_EntityIterator SelectedResult() const; 0139 0140 //! Returns the count of selected and transferred items 0141 Standard_EXPORT Standard_Integer SelectedCount() const; 0142 0143 //! Starts an iteration on selected items. It takes into account 0144 //! IsForAll/IsForNone, by really iterating on all selected items. 0145 Standard_EXPORT void Start(); 0146 0147 //! Returns True until the iteration has finished 0148 Standard_EXPORT Standard_Boolean More() const; 0149 0150 //! Advances the iteration 0151 Standard_EXPORT void Next(); 0152 0153 //! Returns the current selected item in the original model 0154 Standard_EXPORT Handle(Standard_Transient) ValueOriginal() const; 0155 0156 //! Returns the result counterpart of current selected item 0157 //! (in the target model) 0158 Standard_EXPORT Handle(Standard_Transient) ValueResult() const; 0159 0160 //! Traces the application of a Modifier. Works with default trace 0161 //! File and Level. Fills the trace if default trace level is at 0162 //! least 1. Traces the Modifier (its Label) and its Selection if 0163 //! there is one (its Label). 0164 //! To be called after Select (because status IsForAll is printed) 0165 //! Worths to trace a global modification. See also Trace below 0166 Standard_EXPORT void TraceModifier (const Handle(IFSelect_GeneralModifier)& modif); 0167 0168 //! Traces the modification of the current entity (see above, 0169 //! ValueOriginal and ValueResult) for default trace level >= 2. 0170 //! To be called on each individual entity really modified 0171 //! <mess> is an optional additional message 0172 Standard_EXPORT void Trace (const Standard_CString mess = ""); 0173 0174 //! Adds a Check to the CheckList. If it is empty, nothing is done 0175 //! If it concerns an Entity from the Original Model (by SetEntity) 0176 //! to which another Check is attached, it is merged to it. 0177 //! Else, it is added or merged as to GlobalCheck. 0178 Standard_EXPORT void AddCheck (const Handle(Interface_Check)& check); 0179 0180 //! Adds a Warning Message for an Entity from the original Model 0181 //! If <start> is not an Entity from the original model (e.g. the 0182 //! model itself) this message is added to Global Check. 0183 Standard_EXPORT void AddWarning (const Handle(Standard_Transient)& start, const Standard_CString mess, const Standard_CString orig = ""); 0184 0185 //! Adds a Fail Message for an Entity from the original Model 0186 //! If <start> is not an Entity from the original model (e.g. the 0187 //! model itself) this message is added to Global Check. 0188 Standard_EXPORT void AddFail (const Handle(Standard_Transient)& start, const Standard_CString mess, const Standard_CString orig = ""); 0189 0190 //! Returns a Check given an Entity number (in the original Model) 0191 //! by default a Global Check. Creates it the first time. 0192 //! It can then be acknowledged on the spot, in condition that the 0193 //! caller works by reference ("Interface_Check& check = ...") 0194 Standard_EXPORT Handle(Interface_Check) CCheck (const Standard_Integer num = 0); 0195 0196 //! Returns a Check attached to an Entity from the original Model 0197 //! It can then be acknowledged on the spot, in condition that the 0198 //! caller works by reference ("Interface_Check& check = ...") 0199 Standard_EXPORT Handle(Interface_Check) CCheck (const Handle(Standard_Transient)& start); 0200 0201 //! Returns the complete CheckList 0202 Standard_EXPORT Interface_CheckIterator CheckList() const; 0203 0204 private: 0205 0206 Interface_Graph thegraf; 0207 Handle(Interface_Protocol) theprot; 0208 Handle(Interface_CopyControl) themap; 0209 TCollection_AsciiString thefile; 0210 TCollection_AsciiString thelist; 0211 Interface_CheckIterator thechek; 0212 Standard_Boolean thesel; 0213 Standard_Integer thecurr; 0214 Standard_Integer thecurt; 0215 0216 }; 0217 0218 #endif // _IFSelect_ContextModif_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |