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
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_AppliedModifiers_HeaderFile
18 #define _IFSelect_AppliedModifiers_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
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;
31 class IFSelect_AppliedModifiers;
32 DEFINE_STANDARD_HANDLE(IFSelect_AppliedModifiers, Standard_Transient)
34 //! This class allows to memorize and access to the modifiers
35 //! which are to be applied to a file. To each modifier, is bound
36 //! a list of integers (optional) : if this list is absent,
37 //! the modifier applies to all the file. Else, it applies to the
38 //! entities designated by these numbers in the produced file.
40 //! To record a modifier, and a possible list of entity numbers to be applied on:
41 //! AddModif (amodifier);
42 //! loop on AddNum (anumber);
44 //! To query it, Count gives the count of recorded modifiers, then for each one:
45 //! Item (numodif, amodifier, entcount);
46 //! IsForAll () -> can be called, if True, applies on the whole file
48 //! for (i = 1; i <= entcount; i ++)
49 //! nument = ItemNum (i); -> return an entity number
50 class IFSelect_AppliedModifiers : public Standard_Transient
54 //! Creates an AppliedModifiers, ready to record up to <nbmax>
55 //! modifiers, on a model of <nbent> entities
56 Standard_EXPORT IFSelect_AppliedModifiers(const Standard_Integer nbmax, const Standard_Integer nbent);
58 //! Records a modifier. By default, it is to apply on all a
59 //! produced file. Further calls to AddNum will restrict this.
60 //! Returns True if done, False if too many modifiers are already
62 Standard_EXPORT Standard_Boolean AddModif (const Handle(IFSelect_GeneralModifier)& modif);
64 //! Adds a number of entity of the output file to be applied on.
65 //! If a sequence of AddNum is called after AddModif, this
66 //! Modifier will be applied on the list of designated entities.
67 //! Else, it will be applied on all the file
68 //! Returns True if done, False if no modifier has yet been added
69 Standard_EXPORT Standard_Boolean AddNum (const Standard_Integer nument);
71 //! Returns the count of recorded modifiers
72 Standard_EXPORT Standard_Integer Count() const;
74 //! Returns the description for applied modifier n0 <num> :
75 //! the modifier itself, and the count of entities to be applied
76 //! on. If no specific list of number has been defined, returns
77 //! the total count of entities of the file
78 //! If this count is zero, then the modifier applies to all
79 //! the file (see below). Else, the numbers are then queried by
80 //! calls to ItemNum between 1 and <entcount>
81 //! Returns True if OK, False if <num> is out of range
82 Standard_EXPORT Standard_Boolean Item (const Standard_Integer num, Handle(IFSelect_GeneralModifier)& modif, Standard_Integer& entcount);
84 //! Returns a numero of entity to be applied on, given its rank
85 //! in the list. If no list is defined (i.e. for all the file),
86 //! returns <nument> itself, to give all the entities of the file
87 //! Returns 0 if <nument> out of range
88 Standard_EXPORT Standard_Integer ItemNum (const Standard_Integer nument) const;
90 //! Returns the list of entities to be applied on (see Item)
91 //! as a HSequence (IsForAll produces the complete list of all
92 //! the entity numbers of the file
93 Standard_EXPORT Handle(TColStd_HSequenceOfInteger) ItemList() const;
95 //! Returns True if the applied modifier queried by last call to
96 //! Item is to be applied to all the produced file.
97 //! Else, <entcount> returned by Item gives the count of entity
98 //! numbers, each one is queried by ItemNum
99 Standard_EXPORT Standard_Boolean IsForAll() const;
101 DEFINE_STANDARD_RTTIEXT(IFSelect_AppliedModifiers,Standard_Transient)
105 IFSelect_SequenceOfGeneralModifier themodifs;
106 Interface_IntList thelists;
107 Standard_Integer thenbent;
108 Standard_Integer theentcnt;
112 #endif // _IFSelect_AppliedModifiers_HeaderFile