Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:47:15

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