Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-28 09:21:39

0001 // Created on: 2000-08-15
0002 // Created by: Andrey BETENEV
0003 // Copyright (c) 2000-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _STEPCAFControl_Reader_HeaderFile
0017 #define _STEPCAFControl_Reader_HeaderFile
0018 
0019 #include <STEPControl_Reader.hxx>
0020 #include <NCollection_LinearVector.hxx>
0021 #include <StepData_Factors.hxx>
0022 #include <IFSelect_ReturnStatus.hxx>
0023 #include <TDF_Label.hxx>
0024 #include <NCollection_Sequence.hxx>
0025 #include <TopoDS_Shape.hxx>
0026 #include <TopTools_ShapeMapHasher.hxx>
0027 #include <NCollection_Map.hxx>
0028 #include <StepBasic_ProductDefinition.hxx>
0029 #include <NCollection_DataMap.hxx>
0030 #include <STEPCAFControl_ExternFile.hxx>
0031 #include <Standard_Transient.hxx>
0032 #include <NCollection_HSequence.hxx>
0033 #include <XCAFDimTolObjects_DatumSingleModif.hxx>
0034 #include <XCAFDimTolObjects_DatumModifWithValue.hxx>
0035 
0036 class XSControl_WorkSession;
0037 class TDataStd_NamedData;
0038 class TDocStd_Document;
0039 class STEPCAFControl_ExternFile;
0040 class TopoDS_Shape;
0041 class XCAFDoc_ShapeTool;
0042 class StepRepr_RepresentationItem;
0043 class Transfer_TransientProcess;
0044 class StepBasic_NamedUnit;
0045 class StepBasic_Product;
0046 class StepShape_ConnectedFaceSet;
0047 class StepShape_ShapeDefinitionRepresentation;
0048 class StepRepr_NextAssemblyUsageOccurrence;
0049 class StepRepr_PropertyDefinition;
0050 class STEPConstruct_Tool;
0051 class StepDimTol_Datum;
0052 class Transfer_Binder;
0053 
0054 //! Provides a tool to read STEP file and put it into
0055 //! DECAF document. Besides transfer of shapes (including
0056 //! assemblies) provided by STEPControl, supports also
0057 //! colors and part names
0058 //!
0059 //! This reader supports reading files with external references
0060 //! i.e. multifile reading
0061 //! It behaves as usual Reader (from STEPControl) for the main
0062 //! file (e.g. if it is single file)
0063 //! Results of reading other files can be accessed by name of the
0064 //! file or by iterating on a readers
0065 class STEPCAFControl_Reader
0066 {
0067 public:
0068   DEFINE_STANDARD_ALLOC
0069 
0070 public:
0071   //! Creates a reader with an empty
0072   //! STEP model and sets ColorMode, LayerMode, NameMode and
0073   //! PropsMode to true.
0074   Standard_EXPORT STEPCAFControl_Reader();
0075 
0076   //! Creates a reader tool and attaches it to an already existing Session
0077   //! Clears the session if it was not yet set for STEP
0078   Standard_EXPORT STEPCAFControl_Reader(const occ::handle<XSControl_WorkSession>& WS,
0079                                         const bool                                scratch = true);
0080 
0081   //! Destructor.
0082   Standard_EXPORT virtual ~STEPCAFControl_Reader();
0083 
0084   //! Clears the internal data structures and attaches to a new session
0085   //! Clears the session if it was not yet set for STEP
0086   Standard_EXPORT void Init(const occ::handle<XSControl_WorkSession>& WS,
0087                             const bool                                scratch = true);
0088 
0089   //! Loads a file and returns the read status
0090   //! Provided for use like single-file reader.
0091   //! @param[in] theFileName  file to open
0092   //! @return read status
0093   Standard_EXPORT IFSelect_ReturnStatus ReadFile(const char* const theFileName);
0094 
0095   //! Loads a file and returns the read status
0096   //! Provided for use like single-file reader.
0097   //! @param[in] theFileName  file to open
0098   //! @param[in] theParams  default configuration parameters
0099   //! @return read status
0100   Standard_EXPORT IFSelect_ReturnStatus ReadFile(const char* const        theFileName,
0101                                                  const DESTEP_Parameters& theParams);
0102 
0103   //! Loads a file from stream and returns the read status.
0104   //! @param[in] theName  auxiliary stream name
0105   //! @param[in] theIStream  stream to read from
0106   //! @return read status
0107   Standard_EXPORT IFSelect_ReturnStatus ReadStream(const char* const theName,
0108                                                    std::istream&     theIStream);
0109 
0110   //! Returns number of roots recognized for transfer
0111   //! Shortcut for Reader().NbRootsForTransfer()
0112   Standard_EXPORT int NbRootsForTransfer();
0113 
0114   //! Translates currently loaded STEP file into the document
0115   //! Returns True if succeeded, and False in case of fail
0116   //! Provided for use like single-file reader
0117   Standard_EXPORT bool TransferOneRoot(
0118     const int                            num,
0119     const occ::handle<TDocStd_Document>& doc,
0120     const Message_ProgressRange&         theProgress = Message_ProgressRange());
0121 
0122   //! Translates currently loaded STEP file into the document
0123   //! Returns True if succeeded, and False in case of fail
0124   //! Provided for use like single-file reader
0125   Standard_EXPORT bool Transfer(const occ::handle<TDocStd_Document>& doc,
0126                                 const Message_ProgressRange& theProgress = Message_ProgressRange());
0127 
0128   Standard_EXPORT bool Perform(const TCollection_AsciiString&       filename,
0129                                const occ::handle<TDocStd_Document>& doc,
0130                                const Message_ProgressRange& theProgress = Message_ProgressRange());
0131 
0132   Standard_EXPORT bool Perform(const TCollection_AsciiString&       filename,
0133                                const occ::handle<TDocStd_Document>& doc,
0134                                const DESTEP_Parameters&             theParams,
0135                                const Message_ProgressRange& theProgress = Message_ProgressRange());
0136 
0137   //! Translate STEP file given by filename into the document
0138   //! Return True if succeeded, and False in case of fail
0139   Standard_EXPORT bool Perform(const char* const                    filename,
0140                                const occ::handle<TDocStd_Document>& doc,
0141                                const Message_ProgressRange& theProgress = Message_ProgressRange());
0142 
0143   //! Translate STEP file given by filename into the document
0144   //! Return True if succeeded, and False in case of fail
0145   Standard_EXPORT bool Perform(const char* const                    filename,
0146                                const occ::handle<TDocStd_Document>& doc,
0147                                const DESTEP_Parameters&             theParams,
0148                                const Message_ProgressRange& theProgress = Message_ProgressRange());
0149 
0150   //! Returns data on external files
0151   //! Returns Null handle if no external files are read
0152   Standard_EXPORT const NCollection_DataMap<TCollection_AsciiString,
0153                                             occ::handle<STEPCAFControl_ExternFile>>&
0154                         ExternFiles() const;
0155 
0156   //! Returns data on external file by its name
0157   //! Returns False if no external file with given name is read
0158   Standard_EXPORT bool ExternFile(const char* const                       name,
0159                                   occ::handle<STEPCAFControl_ExternFile>& ef) const;
0160 
0161   //! Returns basic reader
0162   Standard_EXPORT STEPControl_Reader& ChangeReader();
0163 
0164   //! Returns basic reader as const
0165   Standard_EXPORT const STEPControl_Reader& Reader() const;
0166 
0167   //! Returns label of instance of an assembly component
0168   //! corresponding to a given NAUO
0169   Standard_EXPORT static TDF_Label FindInstance(
0170     const occ::handle<StepRepr_NextAssemblyUsageOccurrence>&                     NAUO,
0171     const occ::handle<XCAFDoc_ShapeTool>&                                        STool,
0172     const STEPConstruct_Tool&                                                    Tool,
0173     const NCollection_DataMap<TopoDS_Shape, TDF_Label, TopTools_ShapeMapHasher>& ShapeLabelMap);
0174 
0175   //! Set ColorMode for indicate read Colors or not.
0176   Standard_EXPORT void SetColorMode(const bool colormode);
0177 
0178   Standard_EXPORT bool GetColorMode() const;
0179 
0180   //! Set NameMode for indicate read Name or not.
0181   Standard_EXPORT void SetNameMode(const bool namemode);
0182 
0183   Standard_EXPORT bool GetNameMode() const;
0184 
0185   //! Set LayerMode for indicate read Layers or not.
0186   Standard_EXPORT void SetLayerMode(const bool layermode);
0187 
0188   Standard_EXPORT bool GetLayerMode() const;
0189 
0190   //! PropsMode for indicate read Validation properties or not.
0191   Standard_EXPORT void SetPropsMode(const bool propsmode);
0192 
0193   Standard_EXPORT bool GetPropsMode() const;
0194 
0195   //! MetaMode for indicate read Metadata or not.
0196   Standard_EXPORT void SetMetaMode(const bool theMetaMode);
0197 
0198   Standard_EXPORT bool GetMetaMode() const;
0199 
0200   //! MetaMode for indicate whether to read Product Metadata or not.
0201   Standard_EXPORT void SetProductMetaMode(const bool theProductMetaMode);
0202 
0203   Standard_EXPORT bool GetProductMetaMode() const;
0204 
0205   //! Set SHUO mode for indicate write SHUO or not.
0206   Standard_EXPORT void SetSHUOMode(const bool shuomode);
0207 
0208   Standard_EXPORT bool GetSHUOMode() const;
0209 
0210   //! Set GDT mode for indicate write GDT or not.
0211   Standard_EXPORT void SetGDTMode(const bool gdtmode);
0212 
0213   Standard_EXPORT bool GetGDTMode() const;
0214 
0215   //! Set Material mode
0216   Standard_EXPORT void SetMatMode(const bool matmode);
0217 
0218   Standard_EXPORT bool GetMatMode() const;
0219 
0220   //! Set View mode
0221   Standard_EXPORT void SetViewMode(const bool viewmode);
0222 
0223   //! Get View mode
0224   Standard_EXPORT bool GetViewMode() const;
0225 
0226   const NCollection_DataMap<TopoDS_Shape, TDF_Label, TopTools_ShapeMapHasher>& GetShapeLabelMap()
0227     const
0228   {
0229     return myMap;
0230   }
0231 
0232   //! Sets parameters for shape processing.
0233   //! @param theParameters the parameters for shape processing.
0234   Standard_EXPORT void SetShapeFixParameters(
0235     const XSAlgo_ShapeProcessor::ParameterMap& theParameters);
0236 
0237   //! Sets parameters for shape processing.
0238   //! Parameters are moved from the input map.
0239   //! @param theParameters the parameters for shape processing.
0240   Standard_EXPORT void SetShapeFixParameters(XSAlgo_ShapeProcessor::ParameterMap&& theParameters);
0241 
0242   //! Sets parameters for shape processing.
0243   //! Parameters from @p theParameters are copied to the internal map.
0244   //! Parameters from @p theAdditionalParameters are copied to the internal map
0245   //! if they are not present in @p theParameters.
0246   //! @param theParameters the parameters for shape processing.
0247   //! @param theAdditionalParameters the additional parameters for shape processing.
0248   Standard_EXPORT void SetShapeFixParameters(
0249     const DE_ShapeFixParameters&               theParameters,
0250     const XSAlgo_ShapeProcessor::ParameterMap& theAdditionalParameters = {});
0251 
0252   //! Returns parameters for shape processing that was set by SetParameters() method.
0253   //! @return the parameters for shape processing. Empty map if no parameters were set.
0254   Standard_EXPORT const XSAlgo_ShapeProcessor::ParameterMap& GetShapeFixParameters() const;
0255 
0256   //! Sets flags defining operations to be performed on shapes.
0257   //! @param theFlags The flags defining operations to be performed on shapes.
0258   Standard_EXPORT void SetShapeProcessFlags(const ShapeProcess::OperationsFlags& theFlags);
0259 
0260   //! Returns flags defining operations to be performed on shapes.
0261   //! @return Pair of values defining operations to be performed on shapes and a boolean value
0262   //!         that indicates whether the flags were set.
0263   Standard_EXPORT const XSAlgo_ShapeProcessor::ProcessingFlags& GetShapeProcessFlags() const;
0264 
0265 protected:
0266   //! Translates STEP file already loaded into the reader
0267   //! into the document
0268   //! If num==0, translates all roots, else only root number num
0269   //! Returns True if succeeded, and False in case of fail
0270   //! If asOne is True, in case of multiple results composes
0271   //! them into assembly. Fills sequence of produced labels
0272   Standard_EXPORT bool Transfer(STEPControl_Reader&                  rd,
0273                                 const int                            num,
0274                                 const occ::handle<TDocStd_Document>& doc,
0275                                 NCollection_Sequence<TDF_Label>&     Lseq,
0276                                 const bool                           asOne = false,
0277                                 const Message_ProgressRange& theProgress = Message_ProgressRange());
0278 
0279   //! Add a shape to a document
0280   //! Depending on a case, this shape can be added as one, or
0281   //! as assembly, or (in case if it is associated with external
0282   //! reference) taken as that referred shape
0283   Standard_EXPORT TDF_Label
0284     AddShape(const TopoDS_Shape&                                                S,
0285              const occ::handle<XCAFDoc_ShapeTool>&                              STool,
0286              const NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher>&      NewShapesMap,
0287              const NCollection_DataMap<TopoDS_Shape,
0288                                        occ::handle<StepBasic_ProductDefinition>,
0289                                        TopTools_ShapeMapHasher>&                ShapePDMap,
0290              const NCollection_DataMap<occ::handle<StepBasic_ProductDefinition>,
0291                                        occ::handle<STEPCAFControl_ExternFile>>& PDFileMap);
0292 
0293   //! Reads (or if returns already read) extern file with
0294   //! given name
0295   Standard_EXPORT occ::handle<STEPCAFControl_ExternFile> ReadExternFile(
0296     const char* const                    file,
0297     const char* const                    fullpath,
0298     const occ::handle<TDocStd_Document>& doc,
0299     const Message_ProgressRange&         theProgress = Message_ProgressRange());
0300 
0301   //! Reads style assignments from STEP model and sets
0302   //! corresponding color assignments in the DECAF document
0303   Standard_EXPORT bool ReadColors(
0304     const occ::handle<XSControl_WorkSession>& WS,
0305     const occ::handle<TDocStd_Document>&      doc,
0306     const StepData_Factors&                   theLocalFactors = StepData_Factors()) const;
0307 
0308   //! Reads names of parts defined in the STEP model and
0309   //! assigns them to corresponding labels in the DECAF document
0310   Standard_EXPORT bool ReadNames(
0311     const occ::handle<XSControl_WorkSession>&                          WS,
0312     const occ::handle<TDocStd_Document>&                               doc,
0313     const NCollection_DataMap<occ::handle<StepBasic_ProductDefinition>,
0314                               occ::handle<STEPCAFControl_ExternFile>>& PDFileMap) const;
0315 
0316   //! Reads validation properties assigned to shapes in the STEP
0317   //! model and assigns them to corresponding labels in the DECAF
0318   //! document
0319   Standard_EXPORT bool ReadValProps(
0320     const occ::handle<XSControl_WorkSession>&                          WS,
0321     const occ::handle<TDocStd_Document>&                               doc,
0322     const NCollection_DataMap<occ::handle<StepBasic_ProductDefinition>,
0323                               occ::handle<STEPCAFControl_ExternFile>>& PDFileMap,
0324     const StepData_Factors& theLocalFactors = StepData_Factors()) const;
0325 
0326   //! Reads metadata assigned to shapes in the STEP model and
0327   //! assigns them to corresponding labels in the DECAF document
0328   Standard_EXPORT bool ReadMetadata(
0329     const occ::handle<XSControl_WorkSession>& theWS,
0330     const occ::handle<TDocStd_Document>&      theDoc,
0331     const StepData_Factors&                   theLocalFactors = StepData_Factors()) const;
0332 
0333   Standard_EXPORT bool ReadProductMetadata(const occ::handle<XSControl_WorkSession>& theWS,
0334                                            const occ::handle<TDocStd_Document>&      theDoc) const;
0335 
0336   //! Reads layers of parts defined in the STEP model and
0337   //! set reference between shape and layers in the DECAF document
0338   Standard_EXPORT bool ReadLayers(const occ::handle<XSControl_WorkSession>& WS,
0339                                   const occ::handle<TDocStd_Document>&      doc) const;
0340 
0341   //! Reads SHUO for instances defined in the STEP model and
0342   //! set reference between shape instances from different assemblyes
0343   Standard_EXPORT bool ReadSHUOs(
0344     const occ::handle<XSControl_WorkSession>&                          WS,
0345     const occ::handle<TDocStd_Document>&                               doc,
0346     const NCollection_DataMap<occ::handle<StepBasic_ProductDefinition>,
0347                               occ::handle<STEPCAFControl_ExternFile>>& PDFileMap) const;
0348 
0349   //! Reads D&GT for instances defined in the STEP model and
0350   //! set reference between shape instances from different assemblyes
0351   Standard_EXPORT bool ReadGDTs(const occ::handle<XSControl_WorkSession>& WS,
0352                                 const occ::handle<TDocStd_Document>&      doc,
0353                                 const StepData_Factors& theLocalFactors = StepData_Factors());
0354 
0355   //! Reads materials for instances defined in the STEP model and
0356   //! set reference between shape instances from different assemblyes
0357   Standard_EXPORT bool ReadMaterials(
0358     const occ::handle<XSControl_WorkSession>&                                  WS,
0359     const occ::handle<TDocStd_Document>&                                       doc,
0360     const occ::handle<NCollection_HSequence<occ::handle<Standard_Transient>>>& SeqPDS,
0361     const StepData_Factors& theLocalFactors = StepData_Factors()) const;
0362 
0363   //! Reads Views for instances defined in the STEP model
0364   Standard_EXPORT bool ReadViews(
0365     const occ::handle<XSControl_WorkSession>& theWS,
0366     const occ::handle<TDocStd_Document>&      theDoc,
0367     const StepData_Factors&                   theLocalFactors = StepData_Factors()) const;
0368 
0369   //! Populates the sub-Label of the passed TDF Label with shape
0370   //! data associated with the given STEP Representation Item,
0371   //! including naming and topological information.
0372   Standard_EXPORT TDF_Label
0373     SettleShapeData(const occ::handle<StepRepr_RepresentationItem>& theItem,
0374                     const TDF_Label&                                theLab,
0375                     const occ::handle<XCAFDoc_ShapeTool>&           theShapeTool,
0376                     const occ::handle<Transfer_TransientProcess>&   theTP) const;
0377 
0378   //! Given the maps of already translated shapes, this method
0379   //! expands their correspondent Labels in XDE Document so that
0380   //! to have a dedicated sub-Label for each sub-shape coming
0381   //! with associated name in its STEP Representation Item.
0382   Standard_EXPORT void ExpandSubShapes(
0383     const occ::handle<XCAFDoc_ShapeTool>&               theShapeTool,
0384     const NCollection_DataMap<TopoDS_Shape,
0385                               occ::handle<StepBasic_ProductDefinition>,
0386                               TopTools_ShapeMapHasher>& theShapePDMap) const;
0387 
0388   //! Expands the topological structure of Manifold Solid BRep
0389   //! STEP entity to OCAF sub-tree. Entities having no names
0390   //! associated via their Representation Items are skipped.
0391   Standard_EXPORT void ExpandManifoldSolidBrep(
0392     TDF_Label&                                      theLab,
0393     const occ::handle<StepRepr_RepresentationItem>& theItem,
0394     const occ::handle<Transfer_TransientProcess>&   theTP,
0395     const occ::handle<XCAFDoc_ShapeTool>&           theShapeTool) const;
0396 
0397   //! Expands the topological structure of Shell-Based Surface
0398   //! Model STEP entity to OCAF sub-tree. Entities having no names
0399   //! associated via their Representation Items are skipped.
0400   Standard_EXPORT void ExpandSBSM(TDF_Label&                                      theLab,
0401                                   const occ::handle<StepRepr_RepresentationItem>& theItem,
0402                                   const occ::handle<Transfer_TransientProcess>&   theTP,
0403                                   const occ::handle<XCAFDoc_ShapeTool>& theShapeTool) const;
0404 
0405   //! Expands STEP Shell structure to OCAF sub-tree. Entities
0406   //! having no names associated via their Representation Items
0407   //! are skipped.
0408   Standard_EXPORT void ExpandShell(const occ::handle<StepShape_ConnectedFaceSet>& theShell,
0409                                    TDF_Label&                                     theLab,
0410                                    const occ::handle<Transfer_TransientProcess>&  theTP,
0411                                    const occ::handle<XCAFDoc_ShapeTool>& theShapeTool) const;
0412 
0413   //! Convert name into UNICODE text.
0414   Standard_EXPORT virtual TCollection_ExtendedString convertName(
0415     const TCollection_AsciiString& theName) const;
0416 
0417 private:
0418   //! Internal method. Import all Datum attributes and set them to XCAF object. Set connection of
0419   //! Datum to GeomTolerance (theGDTL).
0420   bool setDatumToXCAF(
0421     const occ::handle<StepDimTol_Datum>&                            theDat,
0422     const TDF_Label                                                 theGDTL,
0423     const int                                                       thePositionCounter,
0424     const NCollection_Sequence<XCAFDimTolObjects_DatumSingleModif>& theXCAFModifiers,
0425     const XCAFDimTolObjects_DatumModifWithValue                     theXCAFModifWithVal,
0426     const double                                                    theModifValue,
0427     const occ::handle<TDocStd_Document>&                            theDoc,
0428     const occ::handle<XSControl_WorkSession>&                       theWS,
0429     const StepData_Factors& theLocalFactors = StepData_Factors());
0430 
0431   //! Internal method. Read Datums, connected to GeomTolerance theGDTL.
0432   bool readDatumsAP242(const occ::handle<Standard_Transient>&    theEnt,
0433                        const TDF_Label                           theGDTL,
0434                        const occ::handle<TDocStd_Document>&      theDoc,
0435                        const occ::handle<XSControl_WorkSession>& theWS,
0436                        const StepData_Factors& theLocalFactors = StepData_Factors());
0437 
0438   //! Internal method. Read Dimension or GeomTolerance.
0439   TDF_Label createGDTObjectInXCAF(const occ::handle<Standard_Transient>&    theEnt,
0440                                   const occ::handle<TDocStd_Document>&      theDoc,
0441                                   const occ::handle<XSControl_WorkSession>& theWS,
0442                                   const StepData_Factors& theLocalFactors = StepData_Factors());
0443 
0444   //! Prepares units for transfer
0445   void prepareUnits(const occ::handle<StepData_StepModel>& theModel,
0446                     const occ::handle<TDocStd_Document>&   theDoc,
0447                     StepData_Factors&                      theLocalFactors) const;
0448 
0449   //! Find RepresentationItems
0450   bool findReprItems(const occ::handle<XSControl_WorkSession>&                   theWS,
0451                      const occ::handle<StepShape_ShapeDefinitionRepresentation>& theShDefRepr,
0452                      NCollection_List<occ::handle<Transfer_Binder>>&             theBinders) const;
0453 
0454   //! Fill metadata
0455   bool fillAttributes(const occ::handle<XSControl_WorkSession>&       theWS,
0456                       const occ::handle<StepRepr_PropertyDefinition>& thePropDef,
0457                       const StepData_Factors&                         theLocalFactors,
0458                       occ::handle<TDataStd_NamedData>&                theAttr) const;
0459 
0460   //! Returns the label of the shape associated with the given product definition.
0461   //! @param theTransferProcess The transfer process to use for finding the label.
0462   //! @param theProductDefinition The product definition for which to find the label.
0463   //! @return The label of the shape associated with the given product definition.
0464   TDF_Label getShapeLabelFromProductDefinition(
0465     const occ::handle<Transfer_TransientProcess>&   theTransferProcess,
0466     const occ::handle<StepBasic_ProductDefinition>& theProductDefinition) const;
0467 
0468   //! Returns the product associated with the given product definition.
0469   //! @param theProductDefinition The product definition for which to get the product.
0470   //! @return The product associated with the given product definition.
0471   occ::handle<StepBasic_Product> getProductFromProductDefinition(
0472     const occ::handle<StepBasic_ProductDefinition>& theProductDefinition) const;
0473 
0474   //! Collects property definitions from the given general property and stores them in a vector.
0475   //! @param theWorkSession The work session to use for collecting property definitions.
0476   //! @param theGeneralProperty The general property from which to collect property definitions.
0477   //! @return A vector of collected property definitions.
0478   NCollection_LinearVector<occ::handle<StepRepr_PropertyDefinition>> collectPropertyDefinitions(
0479     const occ::handle<XSControl_WorkSession>& theWorkSession,
0480     const occ::handle<Standard_Transient>&    theGeneralProperty) const;
0481 
0482   //! Collects shape labels from the given property definition.
0483   //! @param theWorkSession The work session to use for collecting shape labels.
0484   //! @param theTransferProcess The transfer process to use for collecting shape labels.
0485   //! @param theSource The property definition from which to collect shape labels.
0486   //! @return A vector of collected shape labels.
0487   NCollection_LinearVector<TDF_Label> collectShapeLabels(
0488     const occ::handle<XSControl_WorkSession>&       theWorkSession,
0489     const occ::handle<Transfer_TransientProcess>&   theTransferProcess,
0490     const occ::handle<StepRepr_PropertyDefinition>& theSource) const;
0491 
0492   //! Collects a group of related property definitions from the given property definition.
0493   //! @p theProperty itself will be added to the result as well.
0494   //! @param theWorkSession The work session to use for collecting related property definitions.
0495   //! @param theProperty The property definition from which to collect related property definitions.
0496   //! @return A vector of collected related property definitions.
0497   NCollection_LinearVector<occ::handle<StepRepr_PropertyDefinition>>
0498     collectRelatedPropertyDefinitions(
0499       const occ::handle<XSControl_WorkSession>&       theWorkSession,
0500       const occ::handle<StepRepr_PropertyDefinition>& theProperty) const;
0501 
0502   //! Helper method to get NamedData attribute assigned to the given label.
0503   //! @param theLabel The label to get NamedData attribute from.
0504   //! @return Handle to the NamedData attribute. Guarantees that the attribute is never null.
0505   occ::handle<TDataStd_NamedData> getNamedData(const TDF_Label& theLabel) const;
0506 
0507   //! Collects binders from the given property definition and stores them in the binder list.
0508   //! @param theWorkSession The work session to use for collecting binders.
0509   //! @param theTransientProcess The transient process to use for collecting binders.
0510   //! @param theSource The property definition from which to collect binders.
0511   //! @param theBinders The list to store the collected binders.
0512   void collectBinders(const occ::handle<XSControl_WorkSession>&       theWorkSession,
0513                       const occ::handle<Transfer_TransientProcess>&   theTransientProcess,
0514                       const occ::handle<StepRepr_PropertyDefinition>& theSource,
0515                       NCollection_List<occ::handle<Transfer_Binder>>& theBinders) const;
0516 
0517 private:
0518   STEPControl_Reader                                                                   myReader;
0519   NCollection_DataMap<TCollection_AsciiString, occ::handle<STEPCAFControl_ExternFile>> myFiles;
0520   NCollection_DataMap<TopoDS_Shape, TDF_Label, TopTools_ShapeMapHasher>                myMap;
0521   bool                                                                                 myColorMode;
0522   bool                                                                                 myNameMode;
0523   bool                                                                                 myLayerMode;
0524   bool                                                                                 myPropsMode;
0525   bool                                                                                 myMetaMode;
0526   bool                                                            myProductMetaMode;
0527   bool                                                            mySHUOMode;
0528   bool                                                            myGDTMode;
0529   bool                                                            myMatMode;
0530   bool                                                            myViewMode;
0531   NCollection_DataMap<occ::handle<Standard_Transient>, TDF_Label> myGDTMap;
0532 };
0533 
0534 #endif // _STEPCAFControl_Reader_HeaderFile