Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/StepData_StepModel.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Created on: 1992-02-11
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 _StepData_StepModel_HeaderFile
0018 #define _StepData_StepModel_HeaderFile
0019 
0020 #include <Interface_EntityList.hxx>
0021 #include <Standard_Integer.hxx>
0022 #include <NCollection_Array1.hxx>
0023 #include <NCollection_HArray1.hxx>
0024 #include <Interface_InterfaceModel.hxx>
0025 #include <Resource_FormatType.hxx>
0026 #include <StepData_Factors.hxx>
0027 #include <DESTEP_Parameters.hxx>
0028 
0029 class Standard_Transient;
0030 class Interface_EntityIterator;
0031 class Interface_Check;
0032 class TCollection_HAsciiString;
0033 
0034 //! Gives access to
0035 //! - entities in a STEP file,
0036 //! - the STEP file header.
0037 class StepData_StepModel : public Interface_InterfaceModel
0038 {
0039 
0040 public:
0041   //! Creates an empty STEP model with an empty header.
0042   Standard_EXPORT StepData_StepModel();
0043 
0044   //! returns entity given its rank.
0045   //! Same as InterfaceEntity, but with a shorter name
0046   Standard_EXPORT occ::handle<Standard_Transient> Entity(const int num) const;
0047 
0048   //! gets header from another Model (uses Header Protocol)
0049   Standard_EXPORT void GetFromAnother(const occ::handle<Interface_InterfaceModel>& other) override;
0050 
0051   //! Returns a New Empty Model, same type as <me>, i.e. StepModel
0052   Standard_EXPORT occ::handle<Interface_InterfaceModel> NewEmptyModel() const override;
0053 
0054   //! returns Header entities under the form of an iterator
0055   Standard_EXPORT Interface_EntityIterator Header() const;
0056 
0057   //! says if a Header entity has a specified type
0058   Standard_EXPORT bool HasHeaderEntity(const occ::handle<Standard_Type>& atype) const;
0059 
0060   //! Returns Header entity with specified type, if there is
0061   Standard_EXPORT occ::handle<Standard_Transient> HeaderEntity(
0062     const occ::handle<Standard_Type>& atype) const;
0063 
0064   //! Clears the Header
0065   Standard_EXPORT void ClearHeader() override;
0066 
0067   //! Adds an Entity to the Header
0068   Standard_EXPORT void AddHeaderEntity(const occ::handle<Standard_Transient>& ent);
0069 
0070   //! Specific Check, checks Header Items with HeaderProtocol
0071   Standard_EXPORT void VerifyCheck(occ::handle<Interface_Check>& ach) const override;
0072 
0073   //! Dumps the Header, with the Header Protocol of StepData.
0074   //! If the Header Protocol is not defined, for each Header Entity,
0075   //! prints its Type. Else sends the Header under the form of
0076   //! HEADER Section of an Ascii Step File
0077   //! <level> is not used because Header is not so big
0078   Standard_EXPORT void DumpHeader(Standard_OStream& S, const int level = 0) const override;
0079 
0080   //! erases specific labels, i.e. clears the map (entity-ident)
0081   Standard_EXPORT void ClearLabels() override;
0082 
0083   //! Attaches an ident to an entity to produce a label
0084   //! (does nothing if <ent> is not in <me>)
0085   Standard_EXPORT void SetIdentLabel(const occ::handle<Standard_Transient>& ent, const int ident);
0086 
0087   //! returns the label ident attached to an entity, 0 if not in me
0088   Standard_EXPORT int IdentLabel(const occ::handle<Standard_Transient>& ent) const;
0089 
0090   //! Prints label specific to STEP norm for a given entity, i.e.
0091   //! if a LabelIdent has been recorded, its value with '#', else
0092   //! the number in the model with '#' and between ()
0093   Standard_EXPORT void PrintLabel(const occ::handle<Standard_Transient>& ent,
0094                                   Standard_OStream&                      S) const override;
0095 
0096   //! Returns a string with the label attached to a given entity,
0097   //! same form as for PrintLabel
0098   Standard_EXPORT occ::handle<TCollection_HAsciiString> StringLabel(
0099     const occ::handle<Standard_Transient>& ent) const override;
0100 
0101   //! Return the encoding of STEP file for converting names into UNICODE.
0102   //! Initialized from "read.step.codepage" variable by constructor, which is Resource_UTF8 by
0103   //! default.
0104   Resource_FormatType SourceCodePage() const { return InternalParameters.ReadCodePage; }
0105 
0106   //! Return the encoding of STEP file for converting names into UNICODE.
0107   void SetSourceCodePage(Resource_FormatType theCode) { InternalParameters.ReadCodePage = theCode; }
0108 
0109   //! Sets local length unit using for transfer process
0110   Standard_EXPORT void SetLocalLengthUnit(const double theUnit);
0111 
0112   //! Returns local length unit using for transfer process (1 by default)
0113   Standard_EXPORT double LocalLengthUnit() const;
0114 
0115   //! Sets length unit using for writing process
0116   Standard_EXPORT void SetWriteLengthUnit(const double theUnit);
0117 
0118   //! Returns length unit using for writing process (1 by default)
0119   Standard_EXPORT double WriteLengthUnit() const;
0120 
0121   //! Returns the unit initialization flag
0122   //! True - the unit was initialized
0123   //! False - the unit value was not initialized, the default value is used
0124   bool IsInitializedUnit() const { return myReadUnitIsInitialized; }
0125 
0126 public:
0127   DESTEP_Parameters InternalParameters;
0128 
0129   DEFINE_STANDARD_RTTIEXT(StepData_StepModel, Interface_InterfaceModel)
0130 
0131 private:
0132   Interface_EntityList                  theheader;
0133   occ::handle<NCollection_HArray1<int>> theidnums;
0134   mutable double                        myWriteUnit              = 1.0;
0135   double                                myLocalLengthUnit        = 1.0;
0136   bool                                  myReadUnitIsInitialized  = false;
0137   mutable bool                          myWriteUnitIsInitialized = false;
0138 };
0139 
0140 #endif // _StepData_StepModel_HeaderFile