42cf5bc1 |
1 | // Created on: 1992-11-10 |
2 | // Created by: Christian CAILLET |
3 | // Copyright (c) 1992-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 _IGESData_DirChecker_HeaderFile |
18 | #define _IGESData_DirChecker_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Boolean.hxx> |
25 | #include <Standard_Integer.hxx> |
26 | #include <IGESData_DefType.hxx> |
27 | class Interface_Check; |
28 | class IGESData_IGESEntity; |
29 | |
30 | |
31 | //! This class centralizes general Checks upon an IGES Entity's |
32 | //! Directory Part. That is : such field Ignored or Required, |
33 | //! or Required with a given Value (for an Integer field) |
34 | //! More precise checks can be performed as necessary, by each |
35 | //! Entity (method OwnCheck). |
36 | //! |
37 | //! Each class of Entity defines its DirChecker (method DirChecker) |
38 | //! and the DirChecker is able to perform its Checks on an Entity |
39 | //! |
40 | //! A Required Value or presence of a field causes a Fail Message |
41 | //! if criterium is not satisfied |
42 | //! An Ignored field causes a Correction Message if the field is |
43 | //! not null/zero |
44 | class IGESData_DirChecker |
45 | { |
46 | public: |
47 | |
48 | DEFINE_STANDARD_ALLOC |
49 | |
50 | |
51 | //! Returns a DirChecker, with no criterium at all to be checked |
52 | Standard_EXPORT IGESData_DirChecker(); |
53 | |
54 | //! Returns a DirChecker, with no criterium except Required Type |
55 | Standard_EXPORT IGESData_DirChecker(const Standard_Integer atype); |
56 | |
57 | //! Returns a DirChecker, with no criterium except Required values |
58 | //! for Type and Form numbers |
59 | Standard_EXPORT IGESData_DirChecker(const Standard_Integer atype, const Standard_Integer aform); |
60 | |
61 | //! Returns a DirChecker, with no criterium except Required values |
62 | //! for Type number (atype), and Required Range for Form number |
63 | //! (which must be between aform1 and aform2 included) |
64 | Standard_EXPORT IGESData_DirChecker(const Standard_Integer atype, const Standard_Integer aform1, const Standard_Integer aform2); |
65 | |
66 | //! Returns True if at least one criterium has already been set |
67 | //! Allows user to store a DirChecker (static variable) then ask |
68 | //! if it has been set before setting it |
69 | Standard_EXPORT Standard_Boolean IsSet() const; |
70 | |
71 | //! Sets a DirChecker with most current criteria, that is : |
72 | //! Structure Ignored ( worths call Structure(crit = DefVoid) ) |
73 | Standard_EXPORT void SetDefault(); |
74 | |
75 | //! Sets Structure criterium. |
76 | //! If crit is DefVoid, Ignored : should not be defined |
77 | //! If crit is DefReference, Required : must be defined |
78 | //! Other values are not taken in account |
79 | Standard_EXPORT void Structure (const IGESData_DefType crit); |
80 | |
81 | //! Sets LineFont criterium |
82 | //! If crit is DefVoid, Ignored : should not be defined |
83 | //! If crit is DefAny, Required : must be defined (value or ref) |
84 | //! If crit is DefValue, Required as a Value (error if Reference) |
85 | //! Other values are not taken in account |
86 | Standard_EXPORT void LineFont (const IGESData_DefType crit); |
87 | |
88 | //! Sets LineWeight criterium |
89 | //! If crit is DefVoid, Ignored : should not be defined |
90 | //! If crit is DefValue, Required |
91 | //! Other values are not taken in account |
92 | Standard_EXPORT void LineWeight (const IGESData_DefType crit); |
93 | |
94 | //! Sets Color criterium |
95 | //! If crit is DefVoid, Ignored : should not be defined |
96 | //! If crit is DefAny, Required : must be defined (value or ref) |
97 | //! Other values are not taken in account |
98 | Standard_EXPORT void Color (const IGESData_DefType crit); |
99 | |
100 | //! Sets Graphics data (LineFont, LineWeight, Color, Level, View) |
101 | //! to be ignored according value of Hierarchy status : |
102 | //! If hierarchy is not given, they are Ignored any way |
103 | //! (that is, they should not be defined) |
104 | //! If hierarchy is given, Graphics are Ignored if the Hierarchy |
105 | //! status has the value given in argument "hierarchy" |
106 | Standard_EXPORT void GraphicsIgnored (const Standard_Integer hierarchy = -1); |
107 | |
108 | //! Sets Blank Status to be ignored |
109 | //! (should not be defined, or its value should be 0) |
110 | Standard_EXPORT void BlankStatusIgnored(); |
111 | |
112 | //! Sets Blank Status to be required at a given value |
113 | Standard_EXPORT void BlankStatusRequired (const Standard_Integer val); |
114 | |
115 | //! Sets Subordinate Status to be ignored |
116 | //! (should not be defined, or its value should be 0) |
117 | Standard_EXPORT void SubordinateStatusIgnored(); |
118 | |
119 | //! Sets Subordinate Status to be required at a given value |
120 | Standard_EXPORT void SubordinateStatusRequired (const Standard_Integer val); |
121 | |
122 | //! Sets Blank Status to be ignored |
123 | //! (should not be defined, or its value should be 0) |
124 | Standard_EXPORT void UseFlagIgnored(); |
125 | |
126 | //! Sets Blank Status to be required at a given value |
127 | //! Give -1 to demand UseFlag not zero (but no precise value req.) |
128 | Standard_EXPORT void UseFlagRequired (const Standard_Integer val); |
129 | |
130 | //! Sets Hierarchy Status to be ignored |
131 | //! (should not be defined, or its value should be 0) |
132 | Standard_EXPORT void HierarchyStatusIgnored(); |
133 | |
134 | //! Sets Hierarchy Status to be required at a given value |
135 | Standard_EXPORT void HierarchyStatusRequired (const Standard_Integer val); |
136 | |
137 | //! Performs the Checks on an IGESEntity, according to the |
138 | //! recorded criteria |
139 | //! In addition, does minimal Checks, such as admitted range for |
140 | //! Status, or presence of Error status in some data (Color, ...) |
141 | Standard_EXPORT void Check (Handle(Interface_Check)& ach, const Handle(IGESData_IGESEntity)& ent) const; |
142 | |
143 | //! Performs a Check only on Values of Type Number and Form Number |
144 | //! This allows to do a check on an Entity not yet completely |
145 | //! filled but of which Type and Form Number have been already set |
146 | Standard_EXPORT void CheckTypeAndForm (Handle(Interface_Check)& ach, const Handle(IGESData_IGESEntity)& ent) const; |
147 | |
148 | //! Corrects the Directory Entry of an IGES Entity as far as it is |
149 | //! possible according recorded criteria without any ambiguity : |
150 | //! - if a numeric Status is required a given value, this value is |
151 | //! enforced |
152 | //! - if an item is required to be Void, or if it recorded as |
153 | //! Erroneous, it is cleared (set to Void) |
154 | //! - Type Number is enforced |
155 | //! - finally Form Number is enforced only if one and only Value |
156 | //! is admitted (no range, see Constructors of DirChecker) |
157 | Standard_EXPORT Standard_Boolean Correct (const Handle(IGESData_IGESEntity)& ent) const; |
158 | |
159 | |
160 | |
161 | |
162 | protected: |
163 | |
164 | |
165 | |
166 | |
167 | |
168 | private: |
169 | |
170 | |
171 | |
172 | Standard_Boolean isitset; |
173 | Standard_Integer thetype; |
174 | Standard_Integer theform1; |
175 | Standard_Integer theform2; |
176 | IGESData_DefType thestructure; |
177 | IGESData_DefType thelinefont; |
178 | IGESData_DefType thelineweig; |
179 | IGESData_DefType thecolor; |
180 | Standard_Integer thegraphier; |
181 | Standard_Integer theblankst; |
182 | Standard_Integer thesubordst; |
183 | Standard_Integer theuseflag; |
184 | Standard_Integer thehierst; |
185 | |
186 | |
187 | }; |
188 | |
189 | |
190 | |
191 | |
192 | |
193 | |
194 | |
195 | #endif // _IGESData_DirChecker_HeaderFile |