0030153: Visualization, TKOpenGl - AIS_ColoredShape::SynchronizeAspects() doesn't...
[occt.git] / src / IFSelect / IFSelect_AppliedModifiers.hxx
1 // Created on: 1994-05-02
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_AppliedModifiers_HeaderFile
18 #define _IFSelect_AppliedModifiers_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <IFSelect_SequenceOfGeneralModifier.hxx>
24 #include <Interface_IntList.hxx>
25 #include <Standard_Integer.hxx>
26 #include <Standard_Transient.hxx>
27 #include <Standard_Boolean.hxx>
28 #include <TColStd_HSequenceOfInteger.hxx>
29 class IFSelect_GeneralModifier;
30
31
32 class IFSelect_AppliedModifiers;
33 DEFINE_STANDARD_HANDLE(IFSelect_AppliedModifiers, Standard_Transient)
34
35 //! This class allows to memorize and access to the modifiers
36 //! which are to be applied to a file. To each modifier, is bound
37 //! a list of integers (optionnal) : if this list is absent, the
38 //! modifier applies to all the file. Else, it applies to the
39 //! entities designated by these numbers in the produced file.
40 //!
41 //! To record a modifier, and a possible list of entity numbers
42 //! to be applied on :
43 //! AddModif (amodifier);
44 //! loop on  AddNum (anumber);
45 //!
46 //! To query it,  Count gives the count of recorded modifiers,
47 //! then for each one :
48 //! Item (numodif, amodifier, entcount);
49 //! IsForAll ()  -> can be called, if True, applies on the whole file
50 //!
51 //! for (i = 1; i <= entcount; i ++)
52 //! nument = ItemNum (i);  -> return an entity number
53 class IFSelect_AppliedModifiers : public Standard_Transient
54 {
55
56 public:
57
58   
59   //! Creates an AppliedModifiers, ready to record up to <nbmax>
60   //! modifiers, on a model of <nbent> entities
61   Standard_EXPORT IFSelect_AppliedModifiers(const Standard_Integer nbmax, const Standard_Integer nbent);
62   
63   //! Records a modifier. By default, it is to apply on all a
64   //! produced file. Further calls to AddNum will restrict this.
65   //! Returns True if done, False if too many modifiers are already
66   //! recorded
67   Standard_EXPORT Standard_Boolean AddModif (const Handle(IFSelect_GeneralModifier)& modif);
68   
69   //! Adds a number of entity of the output file to be applied on.
70   //! If a sequence of AddNum is called after AddModif, this
71   //! Modifier will be applied on the list of designated entities.
72   //! Else, it will be applied on all the file
73   //! Returns True if done, False if no modifier has yet been added
74   Standard_EXPORT Standard_Boolean AddNum (const Standard_Integer nument);
75   
76   //! Returns the count of recorded modifiers
77   Standard_EXPORT Standard_Integer Count() const;
78   
79   //! Returns the description for applied modifier n0 <num> :
80   //! the modifier itself, and the count of entities to be applied
81   //! on. If no specific list of number has been defined, returns
82   //! the total count of entities of the file
83   //! If this count is zero, then the modifier applies to all
84   //! the file (see below). Else, the numbers are then queried by
85   //! calls to ItemNum between 1 and <entcount>
86   //! Returns True if OK, False if <num> is out of range
87   Standard_EXPORT Standard_Boolean Item (const Standard_Integer num, Handle(IFSelect_GeneralModifier)& modif, Standard_Integer& entcount);
88   
89   //! Returns a numero of entity to be applied on, given its rank
90   //! in the list. If no list is defined (i.e. for all the file),
91   //! returns <nument> itself, to give all the entities of the file
92   //! Returns 0 if <nument> out of range
93   Standard_EXPORT Standard_Integer ItemNum (const Standard_Integer nument) const;
94   
95   //! Returns the list of entities to be applied on (see Item)
96   //! as a HSequence (IsForAll produces the complete list of all
97   //! the entity numbers of the file
98   Standard_EXPORT Handle(TColStd_HSequenceOfInteger) ItemList() const;
99   
100   //! Returns True if the applied modifier queried by last call to
101   //! Item is to be applied to all the produced file.
102   //! Else, <entcount> returned by Item gives the count of entity
103   //! numbers, each one is queried by ItemNum
104   Standard_EXPORT Standard_Boolean IsForAll() const;
105
106
107
108
109   DEFINE_STANDARD_RTTIEXT(IFSelect_AppliedModifiers,Standard_Transient)
110
111 protected:
112
113
114
115
116 private:
117
118
119   IFSelect_SequenceOfGeneralModifier themodifs;
120   Interface_IntList thelists;
121   Standard_Integer thenbent;
122   Standard_Integer theentcnt;
123
124
125 };
126
127
128
129
130
131
132
133 #endif // _IFSelect_AppliedModifiers_HeaderFile