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