0030153: Visualization, TKOpenGl - AIS_ColoredShape::SynchronizeAspects() doesn't...
[occt.git] / src / IFSelect / IFSelect_Transformer.hxx
1 // Created on: 1994-05-27
2 // Created by: Christian CAILLET
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _IFSelect_Transformer_HeaderFile
18 #define _IFSelect_Transformer_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <Standard_Transient.hxx>
24 #include <Standard_Boolean.hxx>
25 class Interface_Graph;
26 class Interface_Protocol;
27 class Interface_CheckIterator;
28 class Interface_InterfaceModel;
29 class Standard_Transient;
30 class TCollection_AsciiString;
31
32
33 class IFSelect_Transformer;
34 DEFINE_STANDARD_HANDLE(IFSelect_Transformer, Standard_Transient)
35
36 //! A Transformer defines the way an InterfaceModel is transformed
37 //! (without sending it to a file).
38 //! In order to work, each type of Transformer defines it method
39 //! Perform, it can be parametred as needed.
40 //!
41 //! It receives a Model (the data set) as input. It then can :
42 //! - edit this Model on the spot (i.e. alter its content : by
43 //! editing entities, or adding/replacing some ...)
44 //! - produce a copied Model, which detains the needed changes
45 //! (typically on the same type, but some or all entities beeing
46 //! rebuilt or converted; or converted from a protocol to
47 //! another one)
48 class IFSelect_Transformer : public Standard_Transient
49 {
50
51 public:
52
53   
54   //! Performs a Transformation (defined by each sub-class) :
55   //! <G> gives the input data (especially the starting model) and
56   //! can be used for queries (by Selections, etc...)
57   //! <protocol> allows to work with General Services as necessary
58   //! (it applies to input data)
59   //! If the change corresponds to a conversion to a new protocol,
60   //! see also the method ChangeProtocol
61   //! <checks> stores produced checks messages if any
62   //! <newmod> gives the result of the transformation :
63   //! - if it is Null (i.e. has not been affected), the transformation
64   //! has been made on the spot, it is assumed to cause no change
65   //! to the graph of dependances
66   //! - if it equates the starting Model, it has been transformed on
67   //! the spot (possibiliy some entities were replaced inside it)
68   //! - if it is new, it corresponds to a new data set which replaces
69   //! the starting one
70   //!
71   //! <me> is mutable to allow results for ChangeProtocol to be
72   //! memorized if needed, and to store informations useful for
73   //! the method Updated
74   //!
75   //! Returns True if Done, False if an Error occured : in this case,
76   //! if a new data set has been produced, the transformation
77   //! is ignored, else data may be corrupted.
78   Standard_EXPORT virtual Standard_Boolean Perform (const Interface_Graph& G, const Handle(Interface_Protocol)& protocol, Interface_CheckIterator& checks, Handle(Interface_InterfaceModel)& newmod) = 0;
79   
80   //! This methods allows to declare that the Protocol applied to
81   //! the new Model has changed. It applies to the last call to
82   //! Perform.
83   //!
84   //! Returns True if the Protocol has changed, False else.
85   //! The provided default keeps the starting Protocol. This method
86   //! should be redefined as required by the effect of Perform.
87   Standard_EXPORT virtual Standard_Boolean ChangeProtocol (Handle(Interface_Protocol)& newproto) const;
88   
89   //! This method allows to know what happened to a starting
90   //! entity after the last Perform. If <entfrom> (from starting
91   //! model) has one and only one known item which corresponds in
92   //! the new produced model, this method must return True and
93   //! fill the argument <entto>. Else, it returns False.
94   Standard_EXPORT virtual Standard_Boolean Updated (const Handle(Standard_Transient)& entfrom, Handle(Standard_Transient)& entto) const = 0;
95   
96   //! Returns a text which defines the way a Transformer works
97   //! (to identify the transformation it performs)
98   Standard_EXPORT virtual TCollection_AsciiString Label() const = 0;
99
100
101
102
103   DEFINE_STANDARD_RTTIEXT(IFSelect_Transformer,Standard_Transient)
104
105 protected:
106
107
108
109
110 private:
111
112
113
114
115 };
116
117
118
119
120
121
122
123 #endif // _IFSelect_Transformer_HeaderFile