1 // Created on: 1993-10-19
2 // Created by: Christian CAILLET
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _IFSelect_GeneralModifier_HeaderFile
18 #define _IFSelect_GeneralModifier_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Standard_Boolean.hxx>
24 #include <MMgt_TShared.hxx>
25 class IFSelect_Selection;
26 class IFSelect_Dispatch;
27 class TCollection_AsciiString;
30 class IFSelect_GeneralModifier;
31 DEFINE_STANDARD_HANDLE(IFSelect_GeneralModifier, MMgt_TShared)
33 //! This class gives a frame for Actions which modify the effect
34 //! of a Dispatch, i.e. :
35 //! By Selections and Dispatches, an original Model can be
36 //! splitted into one or more "target" Models : these Models
37 //! contain Entities copied from the original one (that is, a
38 //! part of it). Basically, these dispatched Entities are copied
39 //! as identical to their original counterparts. Also the copied
40 //! Models reproduce the Header of the original one.
42 //! Modifiers allow to change this copied content : this is the
43 //! way to be used for any kind of alterations, adaptations ...
44 //! They are exploited by a ModelCopier, which firstly performs
45 //! the copy operation described by Dispatches, then invokes the
46 //! Modifiers to work on the result.
48 //! Each GeneralModifier can be attached to :
49 //! - all the Models produced
50 //! - a Dispatch (it will be applied to all the Models obtained
51 //! from this Dispatch) designated by its Ident in a ShareOut
52 //! - in addition, to a Selection (facultative) : this adds a
53 //! criterium, the Modifier is invoked on a produced Model only
54 //! if this Model contains an Entity copied from one of the
55 //! Entities designated by this Selection.
56 //! (for special Modifiers from IFAdapt, while they must work on
57 //! definite Entities, this Selection is mandatory to run)
59 //! Remark : this class has no action attached, it only provides
60 //! a frame to work on criteria. Then, sub-classes will define
61 //! their kind of action, which can be applied at a precise step
62 //! of the production of a File : see Modifier, and in the
63 //! package IFAdapt, EntityModifier and EntityCopier
64 class IFSelect_GeneralModifier : public MMgt_TShared
70 //! Returns True if this modifier may change the graph of
71 //! dependences (aknowledged at creation time)
72 Standard_EXPORT Standard_Boolean MayChangeGraph() const;
74 //! Attaches to a Dispatch. If <disp> is Null, Resets it
75 //! (to apply the Modifier on every Dispatch)
76 Standard_EXPORT void SetDispatch (const Handle(IFSelect_Dispatch)& disp);
78 //! Returns the Dispatch to be matched, Null if not set
79 Standard_EXPORT Handle(IFSelect_Dispatch) Dispatch() const;
81 //! Returns True if a Model obtained from the Dispatch <disp>
82 //! is to be treated (apart from the Selection criterium)
83 //! If Dispatch(me) is Null, returns True. Else, checks <disp>
84 Standard_EXPORT Standard_Boolean Applies (const Handle(IFSelect_Dispatch)& disp) const;
86 //! Sets a Selection : a Model is treated if it contains one or
87 //! more Entities designated by the Selection
88 Standard_EXPORT void SetSelection (const Handle(IFSelect_Selection)& sel);
90 //! Resets the Selection : this criterium is not longer active
91 Standard_EXPORT void ResetSelection();
93 //! Returns True if a Selection is set as an additionnal criterium
94 Standard_EXPORT Standard_Boolean HasSelection() const;
96 //! Returns the Selection, or a Null Handle if not set
97 Standard_EXPORT Handle(IFSelect_Selection) Selection() const;
99 //! Returns a short text which defines the operation performed
100 Standard_EXPORT virtual TCollection_AsciiString Label() const = 0;
105 DEFINE_STANDARD_RTTIEXT(IFSelect_GeneralModifier,MMgt_TShared)
110 //! Sets the Modifier criteria to default Values
111 //! (i.e. "always applies")
112 //! <maychangegraph> must be provided at creation time, to :
113 //! - False if this GeneralModifier surely lets the graph of
114 //! dependencies unchanged (NO edition of any reference, BUT
115 //! also NO entity added or replaced or removed)
116 //! - True if there is a possibility of changing the graph of
117 //! dependencies when this modifier is applied
118 Standard_EXPORT IFSelect_GeneralModifier(const Standard_Boolean maychangegraph);
125 Handle(IFSelect_Selection) thesel;
126 Handle(IFSelect_Dispatch) thedisp;
127 Standard_Boolean thechgr;
138 #endif // _IFSelect_GeneralModifier_HeaderFile