Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-29 09:19:16

0001 // Created on: 1992-04-07
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1992-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _IGESData_IGESEntity_HeaderFile
0018 #define _IGESData_IGESEntity_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Standard_Integer.hxx>
0024 #include <IGESData_DefSwitch.hxx>
0025 #include <Interface_EntityList.hxx>
0026 #include <Standard_Transient.hxx>
0027 #include <IGESData_DefType.hxx>
0028 #include <IGESData_DefList.hxx>
0029 #include <Standard_CString.hxx>
0030 class TCollection_HAsciiString;
0031 class IGESData_IGESType;
0032 class IGESData_LineFontEntity;
0033 class IGESData_LevelListEntity;
0034 class IGESData_ViewKindEntity;
0035 class IGESData_TransfEntity;
0036 class IGESData_LabelDisplayEntity;
0037 class IGESData_ColorEntity;
0038 class gp_GTrsf;
0039 class Interface_EntityIterator;
0040 
0041 //! defines root of IGES Entity definition, including Directory
0042 //! Part, lists of (optional) Properties and Associativities
0043 class IGESData_IGESEntity : public Standard_Transient
0044 {
0045 
0046 public:
0047   //! gives IGES typing info (includes "Type" and "Form" data)
0048   Standard_EXPORT IGESData_IGESType IGESType() const;
0049 
0050   //! gives IGES Type Number (often coupled with Form Number)
0051   Standard_EXPORT int TypeNumber() const;
0052 
0053   //! Returns the form number for that
0054   //! type of an IGES entity. The default form number is 0.
0055   Standard_EXPORT int FormNumber() const;
0056 
0057   //! Returns the Entity which has been recorded for a given
0058   //! Field Number, i.e. without any cast. Maps with:
0059   //! 3 : Structure   4 : LineFont     5 : LevelList     6 : View
0060   //! 7 : Transf(ormation Matrix)      8 : LabelDisplay
0061   //! 13 : Color.  Other values give a null handle
0062   //! It can then be of any kind, while specific items have a Type
0063   Standard_EXPORT occ::handle<IGESData_IGESEntity> DirFieldEntity(const int fieldnum) const;
0064 
0065   //! returns True if an IGESEntity is defined with a Structure
0066   //! (it is normally reserved for certain classes, such as Macros)
0067   Standard_EXPORT bool HasStructure() const;
0068 
0069   //! Returns Structure (used by some types of IGES Entities only)
0070   //! Returns a Null Handle if Structure is not defined
0071   Standard_EXPORT occ::handle<IGESData_IGESEntity> Structure() const;
0072 
0073   //! Returns the definition status of LineFont
0074   Standard_EXPORT virtual IGESData_DefType DefLineFont() const;
0075 
0076   //! Returns LineFont definition as an Integer (if defined as Rank)
0077   //! If LineFont is defined as an Entity, returns a negative value
0078   Standard_EXPORT int RankLineFont() const;
0079 
0080   //! Returns LineFont as an Entity (if defined as Reference)
0081   //! Returns a Null Handle if DefLineFont is not "DefReference"
0082   Standard_EXPORT occ::handle<IGESData_LineFontEntity> LineFont() const;
0083 
0084   //! Returns the definition status of Level
0085   Standard_EXPORT virtual IGESData_DefList DefLevel() const;
0086 
0087   //! Returns the level the entity
0088   //! belongs to. Returns -1 if the entity belongs to more than one level.
0089   Standard_EXPORT int Level() const;
0090 
0091   //! Returns LevelList if Level is
0092   //! defined as a list. Returns a null handle if DefLevel is not DefSeveral.
0093   Standard_EXPORT occ::handle<IGESData_LevelListEntity> LevelList() const;
0094 
0095   //! Returns the definition status of
0096   //! the view. This can be: none, one or several.
0097   Standard_EXPORT virtual IGESData_DefList DefView() const;
0098 
0099   //! Returns the view of this IGES entity.
0100   //! This view can be a single view or a list of views.
0101   //! Warning A null handle is returned if the view is not defined.
0102   Standard_EXPORT occ::handle<IGESData_ViewKindEntity> View() const;
0103 
0104   //! Returns the view as a single view
0105   //! if it was defined as such and not as a list of views.
0106   //! Warning A null handle is returned if DefView does not have the value DefOne.
0107   Standard_EXPORT occ::handle<IGESData_ViewKindEntity> SingleView() const;
0108 
0109   //! Returns the view of this IGES entity as a list.
0110   //! Warning A null handle is returned if the
0111   //! definition status does not have the value DefSeveral.
0112   Standard_EXPORT occ::handle<IGESData_ViewKindEntity> ViewList() const;
0113 
0114   //! Returns True if a Transformation Matrix is defined
0115   Standard_EXPORT bool HasTransf() const;
0116 
0117   //! Returns the Transformation Matrix (under IGES definition)
0118   //! Returns a Null Handle if there is none
0119   //! for a more complete use, see Location & CompoundLocation
0120   Standard_EXPORT occ::handle<IGESData_TransfEntity> Transf() const;
0121 
0122   //! Returns True if a LabelDisplay mode is defined for this entity
0123   Standard_EXPORT bool HasLabelDisplay() const;
0124 
0125   //! Returns the Label Display
0126   //! Associativity Entity if there is one. Returns a null handle if there is none.
0127   Standard_EXPORT occ::handle<IGESData_LabelDisplayEntity> LabelDisplay() const;
0128 
0129   //! gives Blank Status (0 visible, 1 blanked)
0130   Standard_EXPORT int BlankStatus() const;
0131 
0132   //! gives Subordinate Switch (0-1-2-3)
0133   Standard_EXPORT int SubordinateStatus() const;
0134 
0135   //! gives Entity's Use Flag (0 to 5)
0136   Standard_EXPORT int UseFlag() const;
0137 
0138   //! gives Hierarchy status (0-1-2)
0139   Standard_EXPORT int HierarchyStatus() const;
0140 
0141   //! Returns the LineWeight Number (0 not defined), see also LineWeight
0142   Standard_EXPORT int LineWeightNumber() const;
0143 
0144   //! Returns the true Line Weight, computed from LineWeightNumber and
0145   //! Global Parameter in the Model by call to SetLineWeight
0146   Standard_EXPORT double LineWeight() const;
0147 
0148   //! Returns the definition status of Color.
0149   Standard_EXPORT virtual IGESData_DefType DefColor() const;
0150 
0151   //! Returns the color definition as
0152   //! an integer value if the color was defined as a rank.
0153   //! Warning A negative value is returned if the color was defined as an entity.
0154   Standard_EXPORT int RankColor() const;
0155 
0156   //! Returns the IGES entity which
0157   //! describes the color of the entity.
0158   //! Returns a null handle if this entity was defined as an integer.
0159   Standard_EXPORT occ::handle<IGESData_ColorEntity> Color() const;
0160 
0161   //! returns "reserved" alphanumeric values res1 and res2
0162   //! res1 and res2 have to be reserved as Character[9 at least]
0163   //! (remark : their content is changed)
0164   //! returned values are ended by null character in 9th
0165   //! returned Boolean is False if res1 and res2 are blank, true else
0166   Standard_EXPORT bool CResValues(char* res1, char* res2) const;
0167 
0168   //! Returns true if a short label is defined.
0169   //! A short label is a non-blank 8-character string.
0170   Standard_EXPORT bool HasShortLabel() const;
0171 
0172   //! Returns the label value for this IGES entity as a string.
0173   //! Warning If the label is blank, this string is null.
0174   Standard_EXPORT occ::handle<TCollection_HAsciiString> ShortLabel() const;
0175 
0176   //! Returns true if a subscript number is defined.
0177   //! A subscript number is an integer used to identify a label.
0178   Standard_EXPORT virtual bool HasSubScriptNumber() const;
0179 
0180   //! Returns the integer subscript number used to identify this IGES entity.
0181   //! Warning 0 is returned if no subscript number is defined for this IGES entity.
0182   Standard_EXPORT int SubScriptNumber() const;
0183 
0184   //! Initializes a directory field as an Entity of any kind
0185   //! See DirFieldEntity for more details
0186   Standard_EXPORT void InitDirFieldEntity(const int                               fieldnum,
0187                                           const occ::handle<IGESData_IGESEntity>& ent);
0188 
0189   //! Initializes Transf, or erases it if <ent> is given Null
0190   Standard_EXPORT void InitTransf(const occ::handle<IGESData_TransfEntity>& ent);
0191 
0192   //! Initializes View, or erases it if <ent> is given Null
0193   Standard_EXPORT void InitView(const occ::handle<IGESData_ViewKindEntity>& ent);
0194 
0195   //! Initializes LineFont : if <ent> is not Null, it gives LineFont,
0196   //! else <rank> gives or erases (if zero) RankLineFont
0197   Standard_EXPORT void InitLineFont(const occ::handle<IGESData_LineFontEntity>& ent,
0198                                     const int                                   rank = 0);
0199 
0200   //! Initializes Level : if <ent> is not Null, it gives LevelList,
0201   //! else <val> gives or erases (if zero) unique Level
0202   Standard_EXPORT void InitLevel(const occ::handle<IGESData_LevelListEntity>& ent,
0203                                  const int                                    val = 0);
0204 
0205   //! Initializes Color data : if <ent> is not Null, it gives Color,
0206   //! else <rank> gives or erases (if zero) RankColor
0207   Standard_EXPORT void InitColor(const occ::handle<IGESData_ColorEntity>& ent, const int rank = 0);
0208 
0209   //! Initializes the Status of Directory Part
0210   Standard_EXPORT void InitStatus(const int blank,
0211                                   const int subordinate,
0212                                   const int useflag,
0213                                   const int hierarchy);
0214 
0215   //! Sets a new Label to an IGES Entity
0216   //! If <sub> is given, it sets value of SubScriptNumber
0217   //! else, SubScriptNumber is erased
0218   Standard_EXPORT void SetLabel(const occ::handle<TCollection_HAsciiString>& label,
0219                                 const int                                    sub = -1);
0220 
0221   //! Initializes various data (those not yet seen above), or erases
0222   //! them if they are given as Null (Zero for <weightnum>) :
0223   //! <str> for Structure, <lab> for LabelDisplay, and
0224   //! <weightnum> for WeightNumber
0225   Standard_EXPORT void InitMisc(const occ::handle<IGESData_IGESEntity>&         str,
0226                                 const occ::handle<IGESData_LabelDisplayEntity>& lab,
0227                                 const int                                       weightnum);
0228 
0229   //! Returns True if an entity has one and only one parent, defined
0230   //! by a SingleParentEntity Type Associativity (explicit sharing).
0231   //! Thus, implicit sharing remains defined at model level
0232   //! (see class ToolLocation)
0233   Standard_EXPORT bool HasOneParent() const;
0234 
0235   //! Returns the Unique Parent (in the sense given by HasOneParent)
0236   //! Error if there is none or several
0237   Standard_EXPORT occ::handle<IGESData_IGESEntity> UniqueParent() const;
0238 
0239   //! Returns Location given by Transf in Directory Part (see above)
0240   //! It must be considered for local definition : if the Entity is
0241   //! set in a "Parent", that one can add its one Location, but this
0242   //! is not taken in account here : see CompoundLocation for that.
0243   //! If no Transf is defined, returns Identity
0244   //! If Transf is itself compound, gives the final result
0245   Standard_EXPORT gp_GTrsf Location() const;
0246 
0247   //! Returns Location considered for Vectors, i.e. without its
0248   //! Translation Part. As Location, it gives local definition.
0249   Standard_EXPORT gp_GTrsf VectorLocation() const;
0250 
0251   //! Returns Location by taking in account a Parent which has its
0252   //! own Location : that one will be combined to that of <me>
0253   //! The Parent is considered only if HasOneParent is True,
0254   //! else it is ignored and CompoundLocation = Location
0255   Standard_EXPORT gp_GTrsf CompoundLocation() const;
0256 
0257   //! says if a Name is defined, as Short Label or as Name Property
0258   //! (Property is looked first, else ShortLabel is considered)
0259   Standard_EXPORT bool HasName() const;
0260 
0261   //! returns Name value as a String (Property Name or ShortLabel)
0262   //! if SubNumber is defined, it is concatenated after ShortLabel
0263   //! as follows label(number). Ignored with a Property Name
0264   Standard_EXPORT occ::handle<TCollection_HAsciiString> NameValue() const;
0265 
0266   //! Returns True if the Entity is defined with an Associativity
0267   //! list, even empty (that is, file contains its length 0)
0268   //! Else, the file contained NO idencation at all about this list.
0269   Standard_EXPORT bool ArePresentAssociativities() const;
0270 
0271   //! gives number of recorded associativities (0 no list defined)
0272   Standard_EXPORT int NbAssociativities() const;
0273 
0274   //! Returns the Associativity List under the form of an EntityIterator.
0275   Standard_EXPORT Interface_EntityIterator Associativities() const;
0276 
0277   //! gives how many Associativities have a given type
0278   Standard_EXPORT int NbTypedAssociativities(const occ::handle<Standard_Type>& atype) const;
0279 
0280   //! returns the Associativity of a given Type (if only one exists)
0281   //! Error if none or more than one
0282   Standard_EXPORT occ::handle<IGESData_IGESEntity> TypedAssociativity(
0283     const occ::handle<Standard_Type>& atype) const;
0284 
0285   //! Sets "me" in the Associativity list of another Entity
0286   Standard_EXPORT void Associate(const occ::handle<IGESData_IGESEntity>& ent) const;
0287 
0288   //! Resets "me" from the Associativity list of another Entity
0289   Standard_EXPORT void Dissociate(const occ::handle<IGESData_IGESEntity>& ent) const;
0290 
0291   //! Returns True if the Entity is defined with a Property list,
0292   //! even empty (that is, file contains its length 0)
0293   //! Else, the file contained NO idencation at all about this list
0294   Standard_EXPORT bool ArePresentProperties() const;
0295 
0296   //! Gives number of recorded properties (0 no list defined)
0297   Standard_EXPORT int NbProperties() const;
0298 
0299   //! Returns Property List under the form of an EntityIterator
0300   Standard_EXPORT Interface_EntityIterator Properties() const;
0301 
0302   //! gives how many Properties have a given type
0303   Standard_EXPORT int NbTypedProperties(const occ::handle<Standard_Type>& atype) const;
0304 
0305   //! returns the Property of a given Type
0306   //! Error if none or more than one
0307   Standard_EXPORT occ::handle<IGESData_IGESEntity> TypedProperty(
0308     const occ::handle<Standard_Type>& atype,
0309     const int                         anum = 0) const;
0310 
0311   //! Adds a Property in the list
0312   Standard_EXPORT void AddProperty(const occ::handle<IGESData_IGESEntity>& ent);
0313 
0314   //! Removes a Property from the list
0315   Standard_EXPORT void RemoveProperty(const occ::handle<IGESData_IGESEntity>& ent);
0316 
0317   //! computes and sets "true" line weight according IGES rules from
0318   //! global data MaxLineWeight (maxv) and LineWeightGrad (gradw),
0319   //! or sets it to defw (Default) if LineWeightNumber is null
0320   Standard_EXPORT void SetLineWeight(const double defw, const double maxw, const int gradw);
0321 
0322   friend class IGESData_ReadWriteModule;
0323   friend class IGESData_GeneralModule;
0324   friend class IGESData_IGESReaderTool;
0325   friend class IGESData_DirChecker;
0326 
0327   DEFINE_STANDARD_RTTIEXT(IGESData_IGESEntity, Standard_Transient)
0328 
0329 protected:
0330   //! prepares lists of optional data, set values to defaults
0331   Standard_EXPORT IGESData_IGESEntity();
0332 
0333   //! Initializes Type and Form Numbers to new values. Reserved for
0334   //! special uses
0335   Standard_EXPORT void InitTypeAndForm(const int typenum, const int formnum);
0336 
0337   //! Loads a complete, already loaded, List of Asociativities
0338   //! (used during Read or Copy Operations)
0339   Standard_EXPORT void LoadAssociativities(const Interface_EntityList& list);
0340 
0341   //! Loads a complete, already loaded, List of Properties
0342   //! (used during Read or Copy Operations)
0343   Standard_EXPORT void LoadProperties(const Interface_EntityList& list);
0344 
0345   //! Removes all properties in once
0346   Standard_EXPORT void ClearProperties();
0347 
0348 private:
0349   //! Clears specific IGES data
0350   Standard_EXPORT void Clear();
0351 
0352   //! Adds an Associativity in the list (called by Associate only)
0353   Standard_EXPORT void AddAssociativity(const occ::handle<IGESData_IGESEntity>& ent);
0354 
0355   //! Removes an Associativity from the list (called by Dissociate)
0356   Standard_EXPORT void RemoveAssociativity(const occ::handle<IGESData_IGESEntity>& ent);
0357 
0358   //! Removes all associativities in once
0359   Standard_EXPORT void ClearAssociativities();
0360 
0361   int                                   theType;
0362   int                                   theForm;
0363   occ::handle<IGESData_IGESEntity>      theStructure;
0364   IGESData_DefSwitch                    theDefLineFont;
0365   occ::handle<IGESData_IGESEntity>      theLineFont;
0366   int                                   theDefLevel;
0367   occ::handle<IGESData_IGESEntity>      theLevelList;
0368   occ::handle<IGESData_IGESEntity>      theView;
0369   occ::handle<IGESData_IGESEntity>      theTransf;
0370   occ::handle<IGESData_IGESEntity>      theLabDisplay;
0371   int                                   theStatusNum;
0372   int                                   theLWeightNum;
0373   double                                theLWeightVal;
0374   IGESData_DefSwitch                    theDefColor;
0375   occ::handle<IGESData_IGESEntity>      theColor;
0376   char                                  theRes1[9];
0377   char                                  theRes2[9];
0378   occ::handle<TCollection_HAsciiString> theShortLabel;
0379   int                                   theSubScriptN;
0380   Interface_EntityList                  theAssocs;
0381   Interface_EntityList                  theProps;
0382 };
0383 
0384 #endif // _IGESData_IGESEntity_HeaderFile