0032641: Coding - get rid of unused forward declarations [IGESAppli to LDOM]
[occt.git] / src / IGESData / IGESData_IGESEntity.hxx
1 // Created on: 1992-04-07
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_IGESEntity_HeaderFile
18 #define _IGESData_IGESEntity_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <Standard_Integer.hxx>
24 #include <IGESData_DefSwitch.hxx>
25 #include <Standard_Real.hxx>
26 #include <Standard_Character.hxx>
27 #include <Interface_EntityList.hxx>
28 #include <Standard_Transient.hxx>
29 #include <Standard_Boolean.hxx>
30 #include <IGESData_DefType.hxx>
31 #include <IGESData_DefList.hxx>
32 #include <Standard_CString.hxx>
33 #include <Standard_Type.hxx>
34 class TCollection_HAsciiString;
35 class IGESData_IGESType;
36 class IGESData_LineFontEntity;
37 class IGESData_LevelListEntity;
38 class IGESData_ViewKindEntity;
39 class IGESData_TransfEntity;
40 class IGESData_LabelDisplayEntity;
41 class IGESData_ColorEntity;
42 class gp_GTrsf;
43 class Interface_EntityIterator;
44
45
46 class IGESData_IGESEntity;
47 DEFINE_STANDARD_HANDLE(IGESData_IGESEntity, Standard_Transient)
48
49 //! defines root of IGES Entity definition, including Directory
50 //! Part, lists of (optional) Properties and Associativities
51 class IGESData_IGESEntity : public Standard_Transient
52 {
53
54 public:
55
56   
57   //! gives IGES typing info (includes "Type" and "Form" data)
58   Standard_EXPORT IGESData_IGESType IGESType() const;
59   
60   //! gives IGES Type Number (often coupled with Form Number)
61   Standard_EXPORT Standard_Integer TypeNumber() const;
62   
63   //! Returns the form number for that
64   //! type of an IGES entity. The default form number is 0.
65   Standard_EXPORT Standard_Integer FormNumber() const;
66   
67   //! Returns the Entity which has been recorded for a given
68   //! Field Number, i.e. without any cast. Maps with :
69   //! 3 : Structure   4 : LineFont     5 : LevelList     6 : View
70   //! 7 : Transf(ormation Matrix)      8 : LabelDisplay
71   //! 13 : Color.  Other values give a null handle
72   //! It can then be of any kind, while specific items have a Type
73   Standard_EXPORT Handle(IGESData_IGESEntity) DirFieldEntity (const Standard_Integer fieldnum) const;
74   
75   //! returns True if an IGESEntity is defined with a Structure
76   //! (it is normally reserved for certain classes, such as Macros)
77   Standard_EXPORT Standard_Boolean HasStructure() const;
78   
79   //! Returns Structure (used by some types of IGES Entities only)
80   //! Returns a Null Handle if Structure is not defined
81   Standard_EXPORT Handle(IGESData_IGESEntity) Structure() const;
82   
83   //! Returns the definition status of LineFont
84   Standard_EXPORT virtual IGESData_DefType DefLineFont() const;
85   
86   //! Returns LineFont definition as an Integer (if defined as Rank)
87   //! If LineFont is defined as an Entity, returns a negative value
88   Standard_EXPORT Standard_Integer RankLineFont() const;
89   
90   //! Returns LineFont as an Entity (if defined as Reference)
91   //! Returns a Null Handle if DefLineFont is not "DefReference"
92   Standard_EXPORT Handle(IGESData_LineFontEntity) LineFont() const;
93   
94   //! Returns the definition status of Level
95   Standard_EXPORT virtual IGESData_DefList DefLevel() const;
96   
97   //! Returns the level the entity
98   //! belongs to. Returns -1 if the entity belongs to more than one  level.
99   Standard_EXPORT Standard_Integer Level() const;
100   
101   //! Returns LevelList if Level is
102   //! defined as a list. Returns a null handle if DefLevel is not DefSeveral.
103   Standard_EXPORT Handle(IGESData_LevelListEntity) LevelList() const;
104   
105   //! Returns the definition status of
106   //! the view. This can be: none, one or several.
107   Standard_EXPORT virtual IGESData_DefList DefView() const;
108   
109   //! Returns the view of this IGES entity.
110   //! This view can be a single view or a list of views.
111   //! Warning A null handle is returned if the view is not defined.
112   Standard_EXPORT Handle(IGESData_ViewKindEntity) View() const;
113   
114   //! Returns the view as a single view
115   //! if it was defined as such and not as a list of views.
116   //! Warning A null handle is returned if DefView does not have the value DefOne.
117   Standard_EXPORT Handle(IGESData_ViewKindEntity) SingleView() const;
118   
119   //! Returns the view of this IGES entity as a list.
120   //! Warning A null handle is returned if the
121   //! definition status does not have the value DefSeveral.
122   Standard_EXPORT Handle(IGESData_ViewKindEntity) ViewList() const;
123   
124   //! Returns True if a Transformation Matrix is defined
125   Standard_EXPORT Standard_Boolean HasTransf() const;
126   
127   //! Returns the Transformation Matrix (under IGES definition)
128   //! Returns a Null Handle if there is none
129   //! for a more complete use, see Location & CompoundLocation
130   Standard_EXPORT Handle(IGESData_TransfEntity) Transf() const;
131   
132   //! Returns True if a LabelDisplay mode is defined for this entity
133   Standard_EXPORT Standard_Boolean HasLabelDisplay() const;
134   
135   //! Returns the Label Display
136   //! Associativity Entity if there is one. Returns a null handle if there is none.
137   Standard_EXPORT Handle(IGESData_LabelDisplayEntity) LabelDisplay() const;
138   
139   //! gives Blank Status (0 visible, 1 blanked)
140   Standard_EXPORT Standard_Integer BlankStatus() const;
141   
142   //! gives Subordinate Switch (0-1-2-3)
143   Standard_EXPORT Standard_Integer SubordinateStatus() const;
144   
145   //! gives Entity's Use Flag (0 to 5)
146   Standard_EXPORT Standard_Integer UseFlag() const;
147   
148   //! gives Hierarchy status (0-1-2)
149   Standard_EXPORT Standard_Integer HierarchyStatus() const;
150   
151   //! Returns the LineWeight Number (0  not defined), see also LineWeight
152   Standard_EXPORT Standard_Integer LineWeightNumber() const;
153   
154   //! Returns the true Line Weight, computed from LineWeightNumber and
155   //! Global Parameter in the Model by call to SetLineWeight
156   Standard_EXPORT Standard_Real LineWeight() const;
157   
158   //! Returns the definition status of Color.
159   Standard_EXPORT virtual IGESData_DefType DefColor() const;
160   
161   //! Returns the color definition as
162   //! an integer value if the color was defined as a rank.
163   //! Warning A negative value is returned if the color was defined as an entity.
164   Standard_EXPORT Standard_Integer RankColor() const;
165   
166   //! Returns the IGES entity which
167   //! describes the color of the entity.
168   //! Returns a null handle if this entity was defined as an integer.
169   Standard_EXPORT Handle(IGESData_ColorEntity) Color() const;
170   
171   //! returns "reserved" alphanumeric values res1 and res2
172   //! res1 and res2 have to be reserved as Character[9 at least]
173   //! (remark : their content is changed)
174   //! returned values are ended by null character in 9th
175   //! returned Boolean is False if res1 and res2 are blank, true else
176   Standard_EXPORT Standard_Boolean CResValues (const Standard_CString res1, const Standard_CString res2) const;
177   
178   //! Returns true if a short label is defined.
179   //! A short label is a non-blank 8-character string.
180   Standard_EXPORT Standard_Boolean HasShortLabel() const;
181   
182   //! Returns the label value for this IGES entity as a string.
183   //! Warning If the label is blank, this string is null.
184   Standard_EXPORT Handle(TCollection_HAsciiString) ShortLabel() const;
185   
186   //! Returns true if a subscript number is defined.
187   //! A subscript number is an integer used to identify a label.
188   Standard_EXPORT virtual Standard_Boolean HasSubScriptNumber() const;
189   
190   //! Returns the integer subscript number used to identify this IGES entity.
191   //! Warning 0 is returned if no subscript number is defined for this IGES entity.
192   Standard_EXPORT Standard_Integer SubScriptNumber() const;
193   
194   //! Initializes a directory field as an Entiy of any kind
195   //! See DirFieldEntity for more details
196   Standard_EXPORT void InitDirFieldEntity (const Standard_Integer fieldnum, const Handle(IGESData_IGESEntity)& ent);
197   
198   //! Initializes Transf, or erases it if <ent> is given Null
199   Standard_EXPORT void InitTransf (const Handle(IGESData_TransfEntity)& ent);
200   
201   //! Initializes View, or erases it if <ent> is given Null
202   Standard_EXPORT void InitView (const Handle(IGESData_ViewKindEntity)& ent);
203   
204   //! Initializes LineFont : if <ent> is not Null, it gives LineFont,
205   //! else <rank> gives or erases (if zero) RankLineFont
206   Standard_EXPORT void InitLineFont (const Handle(IGESData_LineFontEntity)& ent, const Standard_Integer rank = 0);
207   
208   //! Initializes Level : if <ent> is not Null, it gives LevelList,
209   //! else <val> gives or erases (if zero) unique Level
210   Standard_EXPORT void InitLevel (const Handle(IGESData_LevelListEntity)& ent, const Standard_Integer val = 0);
211   
212   //! Initializes Color data : if <ent> is not Null, it gives Color,
213   //! else <rank> gives or erases (if zero) RankColor
214   Standard_EXPORT void InitColor (const Handle(IGESData_ColorEntity)& ent, const Standard_Integer rank = 0);
215   
216   //! Initializes the Status of Directory Part
217   Standard_EXPORT void InitStatus (const Standard_Integer blank, const Standard_Integer subordinate, const Standard_Integer useflag, const Standard_Integer hierarchy);
218   
219   //! Sets a new Label to an IGES Entity
220   //! If <sub> is given, it sets value of SubScriptNumber
221   //! else, SubScriptNumber is erased
222   Standard_EXPORT void SetLabel (const Handle(TCollection_HAsciiString)& label, const Standard_Integer sub = -1);
223   
224   //! Initializes various data (those not yet seen above), or erases
225   //! them if they are given as Null (Zero for <weightnum>) :
226   //! <str> for Structure, <lab> for LabelDisplay, and
227   //! <weightnum> for WeightNumber
228   Standard_EXPORT void InitMisc (const Handle(IGESData_IGESEntity)& str, const Handle(IGESData_LabelDisplayEntity)& lab, const Standard_Integer weightnum);
229   
230   //! Returns True if an entity has one and only one parent, defined
231   //! by a SingleParentEntity Type Associativity (explicit sharing).
232   //! Thus, implicit sharing remains defined at model level
233   //! (see class ToolLocation)
234   Standard_EXPORT Standard_Boolean HasOneParent() const;
235   
236   //! Returns the Unique Parent (in the sense given by HasOneParent)
237   //! Error if there is none or several
238   Standard_EXPORT Handle(IGESData_IGESEntity) UniqueParent() const;
239   
240   //! Returns Location given by Transf in Directory Part (see above)
241   //! It must be considered for local definition : if the Entity is
242   //! set in a "Parent", that one can add its one Location, but this
243   //! is not taken in account here : see CompoundLocation for that.
244   //! If no Transf is defined, returns Identity
245   //! If Transf is itself compound, gives the final result
246   Standard_EXPORT gp_GTrsf Location() const;
247   
248   //! Returns Location considered for Vectors, i.e. without its
249   //! Translation Part. As Location, it gives local definition.
250   Standard_EXPORT gp_GTrsf VectorLocation() const;
251   
252   //! Returns Location by taking in account a Parent which has its
253   //! own Location : that one will be combined to that of <me>
254   //! The Parent is considered only if HasOneParent is True,
255   //! else it is ignored and CompoundLocation = Location
256   Standard_EXPORT gp_GTrsf CompoundLocation() const;
257   
258   //! says if a Name is defined, as Short Label or as Name Property
259   //! (Property is looked first, else ShortLabel is considered)
260   Standard_EXPORT Standard_Boolean HasName() const;
261   
262   //! returns Name value as a String (Property Name or ShortLabel)
263   //! if SubNumber is defined, it is concatenated after ShortLabel
264   //! as follows label(number). Ignored with a Property Name
265   Standard_EXPORT Handle(TCollection_HAsciiString) NameValue() const;
266   
267   //! Returns True if the Entity is defined with an Associativity
268   //! list, even empty (that is, file contains its length 0)
269   //! Else, the file contained NO idencation at all about this list.
270   Standard_EXPORT Standard_Boolean ArePresentAssociativities() const;
271   
272   //! gives number of recorded associativities (0  no list defined)
273   Standard_EXPORT Standard_Integer NbAssociativities() const;
274   
275   //! Returns the Associativity List under the form of an EntityIterator.
276   Standard_EXPORT Interface_EntityIterator Associativities() const;
277   
278   //! gives how many Associativities have a given type
279   Standard_EXPORT Standard_Integer NbTypedAssociativities (const Handle(Standard_Type)& atype) const;
280   
281   //! returns the Associativity of a given Type (if only one exists)
282   //! Error if none or more than one
283   Standard_EXPORT Handle(IGESData_IGESEntity) TypedAssociativity (const Handle(Standard_Type)& atype) const;
284   
285   //! Sets "me" in the Associativity list of another Entity
286   Standard_EXPORT void Associate (const Handle(IGESData_IGESEntity)& ent) const;
287   
288   //! Resets "me" from the Associativity list of another Entity
289   Standard_EXPORT void Dissociate (const Handle(IGESData_IGESEntity)& ent) const;
290   
291   //! Returns True if the Entity is defined with a Property list,
292   //! even empty (that is, file contains its length 0)
293   //! Else, the file contained NO idencation at all about this list
294   Standard_EXPORT Standard_Boolean ArePresentProperties() const;
295   
296   //! Gives number of recorded properties (0  no list defined)
297   Standard_EXPORT Standard_Integer NbProperties() const;
298   
299   //! Returns Property List under the form of an EntityIterator
300   Standard_EXPORT Interface_EntityIterator Properties() const;
301   
302   //! gives how many Properties have a given type
303   Standard_EXPORT Standard_Integer NbTypedProperties (const Handle(Standard_Type)& atype) const;
304   
305   //! returns the Property of a given Type
306   //! Error if none or more than one
307   Standard_EXPORT Handle(IGESData_IGESEntity) TypedProperty (const Handle(Standard_Type)& atype, const Standard_Integer anum = 0) const;
308   
309   //! Adds a Property in the list
310   Standard_EXPORT void AddProperty (const Handle(IGESData_IGESEntity)& ent);
311   
312   //! Removes a Property from the list
313   Standard_EXPORT void RemoveProperty (const Handle(IGESData_IGESEntity)& ent);
314   
315   //! computes and sets "true" line weight according IGES rules from
316   //! global data MaxLineWeight (maxv) and LineWeightGrad (gradw),
317   //! or sets it to defw (Default) if LineWeightNumber is null
318   Standard_EXPORT void SetLineWeight (const Standard_Real defw, const Standard_Real maxw, const Standard_Integer gradw);
319
320
321 friend class IGESData_ReadWriteModule;
322 friend class IGESData_GeneralModule;
323 friend class IGESData_IGESReaderTool;
324 friend class IGESData_DirChecker;
325
326
327   DEFINE_STANDARD_RTTIEXT(IGESData_IGESEntity,Standard_Transient)
328
329 protected:
330
331   
332   //! prepares lists of optional data, set values to defaults
333   Standard_EXPORT IGESData_IGESEntity();
334   
335   //! Initializes Type and Form Numbers to new values. Reserved for
336   //! special uses
337   Standard_EXPORT void InitTypeAndForm (const Standard_Integer typenum, const Standard_Integer formnum);
338   
339   //! Loads a complete, already loaded, List of Asociativities
340   //! (used during Read or Copy Operations)
341   Standard_EXPORT void LoadAssociativities (const Interface_EntityList& list);
342   
343   //! Loads a complete, already loaded, List of Properties
344   //! (used during Read or Copy Operations)
345   Standard_EXPORT void LoadProperties (const Interface_EntityList& list);
346   
347   //! Removes all properties in once
348   Standard_EXPORT void ClearProperties();
349
350
351
352 private:
353
354   
355   //! Clears specific IGES data
356   Standard_EXPORT void Clear();
357   
358   //! Adds an Associativity in the list (called by Associate only)
359   Standard_EXPORT void AddAssociativity (const Handle(IGESData_IGESEntity)& ent);
360   
361   //! Removes an Associativity from the list (called by Dissociate)
362   Standard_EXPORT void RemoveAssociativity (const Handle(IGESData_IGESEntity)& ent);
363   
364   //! Removes all associativities in once
365   Standard_EXPORT void ClearAssociativities();
366
367   Standard_Integer theType;
368   Standard_Integer theForm;
369   Handle(IGESData_IGESEntity) theStructure;
370   IGESData_DefSwitch theDefLineFont;
371   Handle(IGESData_IGESEntity) theLineFont;
372   Standard_Integer theDefLevel;
373   Handle(IGESData_IGESEntity) theLevelList;
374   Handle(IGESData_IGESEntity) theView;
375   Handle(IGESData_IGESEntity) theTransf;
376   Handle(IGESData_IGESEntity) theLabDisplay;
377   Standard_Integer theStatusNum;
378   Standard_Integer theLWeightNum;
379   Standard_Real theLWeightVal;
380   IGESData_DefSwitch theDefColor;
381   Handle(IGESData_IGESEntity) theColor;
382   Standard_Character theRes1[9];
383   Standard_Character theRes2[9];
384   Handle(TCollection_HAsciiString) theShortLabel;
385   Standard_Integer theSubScriptN;
386   Interface_EntityList theAssocs;
387   Interface_EntityList theProps;
388
389
390 };
391
392
393
394
395
396
397
398 #endif // _IGESData_IGESEntity_HeaderFile