Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:55

0001 // Created on: 1994-05-27
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_TransformStandard_HeaderFile
0018 #define _IFSelect_TransformStandard_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <IFSelect_SequenceOfGeneralModifier.hxx>
0024 #include <IFSelect_Transformer.hxx>
0025 #include <Standard_Integer.hxx>
0026 class IFSelect_Selection;
0027 class Interface_CopyControl;
0028 class IFSelect_Modifier;
0029 class Interface_Graph;
0030 class Interface_Protocol;
0031 class Interface_CheckIterator;
0032 class Interface_InterfaceModel;
0033 class Interface_CopyTool;
0034 class Standard_Transient;
0035 class TCollection_AsciiString;
0036 
0037 class IFSelect_TransformStandard;
0038 DEFINE_STANDARD_HANDLE(IFSelect_TransformStandard, IFSelect_Transformer)
0039 
0040 //! This class runs transformations made by Modifiers, as
0041 //! the ModelCopier does when it produces files (the same set
0042 //! of Modifiers can then be used, as to transform the starting
0043 //! Model, as at file sending time).
0044 //!
0045 //! First, considering the resulting model, two options :
0046 //! - modifications are made directly on the starting model
0047 //! (OnTheSpot option), or
0048 //! - data are copied by the standard service Copy, only the
0049 //! remaining (not yet sent in a file) entities are copied
0050 //! (StandardCopy option)
0051 //!
0052 //! If a Selection is set, it forces the list of Entities on which
0053 //! the Modifiers are applied. Else, each Modifier is considered
0054 //! its Selection. By default, it is for the whole Model
0055 //!
0056 //! Then, the Modifiers are sequentially applied
0057 //! If at least one Modifier "May Change Graph", or if the option
0058 //! StandardCopy is selected, the graph will be recomputed
0059 //! (by the WorkSession, see method RunTransformer)
0060 //!
0061 //! Remark that a TransformStandard with option StandardCopy
0062 //! and no Modifier at all has the effect of computing the
0063 //! remaining data (those not yet sent in any output file).
0064 //! Moreover, the Protocol is not changed
0065 class IFSelect_TransformStandard : public IFSelect_Transformer
0066 {
0067 
0068 public:
0069 
0070   //! Creates a TransformStandard, option StandardCopy, no Modifier
0071   Standard_EXPORT IFSelect_TransformStandard();
0072   
0073   //! Sets the Copy option to a new value :
0074   //! - True for StandardCopy  - False for OnTheSpot
0075   Standard_EXPORT void SetCopyOption (const Standard_Boolean option);
0076   
0077   //! Returns the Copy option
0078   Standard_EXPORT Standard_Boolean CopyOption() const;
0079   
0080   //! Sets a Selection (or unsets if Null)
0081   //! This Selection then defines the list of entities on which the
0082   //! Modifiers will be applied
0083   //! If it is set, it has priority on Selections of Modifiers
0084   //! Else, for each Modifier its Selection is evaluated
0085   //! By default, all the Model is taken
0086   Standard_EXPORT void SetSelection (const Handle(IFSelect_Selection)& sel);
0087   
0088   //! Returns the Selection, Null by default
0089   Standard_EXPORT Handle(IFSelect_Selection) Selection() const;
0090   
0091   //! Returns the count of recorded Modifiers
0092   Standard_EXPORT Standard_Integer NbModifiers() const;
0093   
0094   //! Returns a Modifier given its rank in the list
0095   Standard_EXPORT Handle(IFSelect_Modifier) Modifier (const Standard_Integer num) const;
0096   
0097   //! Returns the rank of a Modifier in the list, 0 if unknown
0098   Standard_EXPORT Standard_Integer ModifierRank (const Handle(IFSelect_Modifier)& modif) const;
0099   
0100   //! Adds a Modifier to the list :
0101   //! - <atnum> = 0 (default) : at the end of the list
0102   //! - <atnum> > 0 : at rank <atnum>
0103   //! Returns True if done, False if <atnum> is out of range
0104   Standard_EXPORT Standard_Boolean AddModifier (const Handle(IFSelect_Modifier)& modif, const Standard_Integer atnum = 0);
0105   
0106   //! Removes a Modifier from the list
0107   //! Returns True if done, False if <modif> not in the list
0108   Standard_EXPORT Standard_Boolean RemoveModifier (const Handle(IFSelect_Modifier)& modif);
0109   
0110   //! Removes a Modifier from the list, given its rank
0111   //! Returns True if done, False if <num> is out of range
0112   Standard_EXPORT Standard_Boolean RemoveModifier (const Standard_Integer num);
0113   
0114   //! Performs the Standard Transformation, by calling Copy then
0115   //! ApplyModifiers (which can return an error status)
0116   Standard_EXPORT Standard_Boolean Perform (const Interface_Graph& G, const Handle(Interface_Protocol)& protocol, Interface_CheckIterator& checks, Handle(Interface_InterfaceModel)& newmod) Standard_OVERRIDE;
0117   
0118   //! This the first operation. It calls StandardCopy or OnTheSpot
0119   //! according the option
0120   Standard_EXPORT void Copy (const Interface_Graph& G, Interface_CopyTool& TC, Handle(Interface_InterfaceModel)& newmod) const;
0121   
0122   //! This is the standard action of Copy : its takes into account
0123   //! only the remaining entities (noted by Graph Status positive)
0124   //! and their proper dependances of course. Produces a new model.
0125   Standard_EXPORT void StandardCopy (const Interface_Graph& G, Interface_CopyTool& TC, Handle(Interface_InterfaceModel)& newmod) const;
0126   
0127   //! This is the OnTheSpot action : each entity is bound with ...
0128   //! itself. The produced model is the same as the starting one.
0129   Standard_EXPORT void OnTheSpot (const Interface_Graph& G, Interface_CopyTool& TC, Handle(Interface_InterfaceModel)& newmod) const;
0130 
0131   //! Applies the modifiers sequentially.
0132   //! For each one, prepares required data (if a Selection is associated as a filter).
0133   //! For the option OnTheSpot, it determines if the graph may be
0134   //! changed and updates <newmod> if required
0135   //! If a Modifier causes an error (check "HasFailed"),
0136   //! ApplyModifier stops : the following Modifiers are ignored
0137   Standard_EXPORT Standard_Boolean ApplyModifiers (const Interface_Graph& G, const Handle(Interface_Protocol)& protocol, Interface_CopyTool& TC, Interface_CheckIterator& checks, Handle(Interface_InterfaceModel)& newmod) const;
0138 
0139   //! This methods allows to know what happened to a starting
0140   //! entity after the last Perform. It reads result from the map
0141   //! which was filled by Perform.
0142   Standard_EXPORT Standard_Boolean Updated (const Handle(Standard_Transient)& entfrom, Handle(Standard_Transient)& entto) const Standard_OVERRIDE;
0143   
0144   //! Returns a text which defines the way a Transformer works :
0145   //! "On the spot edition" or "Standard Copy" followed by
0146   //! "<nn> Modifiers"
0147   Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
0148 
0149   DEFINE_STANDARD_RTTIEXT(IFSelect_TransformStandard,IFSelect_Transformer)
0150 
0151 private:
0152 
0153   Standard_Boolean thecopy;
0154   Handle(IFSelect_Selection) thesel;
0155   IFSelect_SequenceOfGeneralModifier themodifs;
0156   Handle(Interface_CopyControl) themap;
0157 
0158 };
0159 
0160 #endif // _IFSelect_TransformStandard_HeaderFile