Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/XCAFDoc_ShapeTool.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: 2000-06-15
0002 // Created by: Edward AGAPOV
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 _XCAFDoc_ShapeTool_HeaderFile
0017 #define _XCAFDoc_ShapeTool_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 
0021 #include <TDF_Label.hxx>
0022 #include <TopTools_ShapeMapHasher.hxx>
0023 #include <NCollection_DataMap.hxx>
0024 #include <Standard_Boolean.hxx>
0025 #include <TDataStd_NamedData.hxx>
0026 #include <TDataStd_GenericEmpty.hxx>
0027 #include <NCollection_Map.hxx>
0028 #include <NCollection_Sequence.hxx>
0029 #include <Standard_Integer.hxx>
0030 #include <Standard_OStream.hxx>
0031 #include <TCollection_HAsciiString.hxx>
0032 #include <TDF_Attribute.hxx>
0033 #include <TopoDS_Shape.hxx>
0034 class Standard_GUID;
0035 class TDF_Label;
0036 class TopoDS_Shape;
0037 class TopLoc_Location;
0038 class XCAFDoc_GraphNode;
0039 
0040 //! A tool to store shapes in an XDE
0041 //! document in the form of assembly structure, and to maintain this structure.
0042 //! Attribute containing Shapes section of DECAF document.
0043 //! Provide tools for management of Shapes section.
0044 //! The API provided by this class allows to work with this
0045 //! structure regardless of its low-level implementation.
0046 //! All the shapes are stored on child labels of a main label which is
0047 //! XCAFDoc_DocumentTool::LabelShapes(). The label for assembly also has
0048 //! sub-labels, each of which represents the instance of
0049 //! another shape in that assembly (component). Such sub-label
0050 //! stores reference to the label of the original shape in the form
0051 //! of TDataStd_TreeNode with GUID XCAFDoc::ShapeRefGUID(), and its
0052 //! location encapsulated into the NamedShape.
0053 //! For correct work with an XDE document, it is necessary to use
0054 //! methods for analysis and methods for working with shapes.
0055 //! For example:
0056 //! if ( STool->IsAssembly(aLabel) )
0057 //! { bool subchilds = false; (default)
0058 //! int nbc = STool->NbComponents
0059 //! (aLabel[,subchilds]);
0060 //! }
0061 //! If subchilds is True, commands also consider sub-levels. By
0062 //! default, only level one is checked.
0063 //! In this example, number of children from the first level of
0064 //! assembly will be returned. Methods for creation and initialization:
0065 //! Constructor:
0066 //! XCAFDoc_ShapeTool::XCAFDoc_ShapeTool()
0067 //! Getting a guid:
0068 //! Standard_GUID GetID ();
0069 //! Creation (if does not exist) of ShapeTool on label L:
0070 //! occ::handle<XCAFDoc_ShapeTool> XCAFDoc_ShapeTool::Set(const TDF_Label& L)
0071 //! Analyze whether shape is a simple shape or an instance or a
0072 //! component of an assembly or it is an assembly ( methods of analysis).
0073 //! For example:
0074 //! STool->IsShape(aLabel) ;
0075 //! Analyze that the label represents a shape (simple
0076 //! shape, assembly or reference) or
0077 //! STool->IsTopLevel(aLabel);
0078 //! Analyze that the label is a label of a top-level shape.
0079 //! Work with simple shapes, assemblies and instances (
0080 //! methods for work with shapes).
0081 //! For example:
0082 //! Add shape:
0083 //! bool makeAssembly;
0084 //! // True to interpret a Compound as an Assembly, False to take it
0085 //! as a whole
0086 //! aLabel = STool->AddShape(aShape, makeAssembly);
0087 //! Get shape:
0088 //! TDF_Label aLabel...
0089 //! // A label must be present if
0090 //! (aLabel.IsNull()) { ... no such label : abandon .. }
0091 //! TopoDS_Shape aShape;
0092 //! aShape = STool->GetShape(aLabel);
0093 //! if (aShape.IsNull())
0094 //! { ... this label is not for a Shape ... }
0095 //! To get a label from shape.
0096 //! bool findInstance = false;
0097 //! (this is default value)
0098 //! aLabel = STool->FindShape(aShape [,findInstance]);
0099 //! if (aLabel.IsNull())
0100 //! { ... no label found for this shape ... }
0101 class XCAFDoc_ShapeTool : public TDataStd_GenericEmpty
0102 {
0103 
0104 public:
0105   Standard_EXPORT static const Standard_GUID& GetID();
0106 
0107   //! Create (if not exist) ShapeTool from XCAFDoc on <L>.
0108   Standard_EXPORT static occ::handle<XCAFDoc_ShapeTool> Set(const TDF_Label& L);
0109 
0110   //! Creates an empty tool
0111   //! Creates a tool to work with a document <Doc>
0112   //! Attaches to label XCAFDoc::LabelShapes()
0113   Standard_EXPORT XCAFDoc_ShapeTool();
0114 
0115   //! Returns True if the label is a label of top-level shape,
0116   //! as opposed to component of assembly or subshape
0117   Standard_EXPORT bool IsTopLevel(const TDF_Label& L) const;
0118 
0119   //! Returns True if the label is not used by any assembly, i.e.
0120   //! contains sublabels which are assembly components
0121   //! This is relevant only if IsShape() is True
0122   //! (There is no Father TreeNode on this <L>)
0123   Standard_EXPORT static bool IsFree(const TDF_Label& L);
0124 
0125   //! Returns True if the label represents a shape (simple shape,
0126   //! assembly or reference)
0127   Standard_EXPORT static bool IsShape(const TDF_Label& L);
0128 
0129   //! Returns True if the label is a label of simple shape
0130   Standard_EXPORT static bool IsSimpleShape(const TDF_Label& L);
0131 
0132   //! Return true if <L> is a located instance of other shape
0133   //! i.e. reference
0134   Standard_EXPORT static bool IsReference(const TDF_Label& L);
0135 
0136   //! Returns True if the label is a label of assembly, i.e.
0137   //! contains sublabels which are assembly components
0138   //! This is relevant only if IsShape() is True
0139   Standard_EXPORT static bool IsAssembly(const TDF_Label& L);
0140 
0141   //! Return true if <L> is reference serving as component
0142   //! of assembly
0143   Standard_EXPORT static bool IsComponent(const TDF_Label& L);
0144 
0145   //! Returns True if the label is a label of compound, i.e.
0146   //! contains some sublabels
0147   //! This is relevant only if IsShape() is True
0148   Standard_EXPORT static bool IsCompound(const TDF_Label& L);
0149 
0150   //! Return true if <L> is subshape of the top-level shape
0151   Standard_EXPORT static bool IsSubShape(const TDF_Label& L);
0152 
0153   //! Checks whether shape <sub> is subshape of shape stored on
0154   //! label shapeL
0155   Standard_EXPORT bool IsSubShape(const TDF_Label& shapeL, const TopoDS_Shape& sub) const;
0156 
0157   Standard_EXPORT bool SearchUsingMap(const TopoDS_Shape& S,
0158                                       TDF_Label&          L,
0159                                       const bool          findWithoutLoc,
0160                                       const bool          findSubshape) const;
0161 
0162   //! General tool to find a (sub) shape in the document
0163   //! * If findInstance is True, and S has a non-null location,
0164   //! first tries to find the shape among the top-level shapes
0165   //! with this location
0166   //! * If not found, and findComponent is True, tries to find the shape
0167   //! among the components of assemblies
0168   //! * If not found, tries to find the shape without location
0169   //! among top-level shapes
0170   //! * If not found and findSubshape is True, tries to find a
0171   //! shape as a subshape of top-level simple shapes
0172   //! Returns False if nothing is found
0173   Standard_EXPORT bool Search(const TopoDS_Shape& S,
0174                               TDF_Label&          L,
0175                               const bool          findInstance  = true,
0176                               const bool          findComponent = true,
0177                               const bool          findSubshape  = true) const;
0178 
0179   //! Returns the label corresponding to shape S
0180   //! (searches among top-level shapes, not including subcomponents
0181   //! of assemblies and subshapes)
0182   //! If findInstance is False (default), search for the
0183   //! input shape without location
0184   //! If findInstance is True, searches for the
0185   //! input shape as is.
0186   //! Return True if <S> is found.
0187   Standard_EXPORT bool FindShape(const TopoDS_Shape& S,
0188                                  TDF_Label&          L,
0189                                  const bool          findInstance = false) const;
0190 
0191   //! Does the same as previous method
0192   //! Returns Null label if not found
0193   Standard_EXPORT TDF_Label FindShape(const TopoDS_Shape& S, const bool findInstance = false) const;
0194 
0195   //! To get TopoDS_Shape from shape's label
0196   //! For component, returns new shape with correct location
0197   //! Returns False if label does not contain shape
0198   Standard_EXPORT static bool GetShape(const TDF_Label& L, TopoDS_Shape& S);
0199 
0200   //! To get TopoDS_Shape from shape's label
0201   //! For component, returns new shape with correct location
0202   //! Returns Null shape if label does not contain shape
0203   Standard_EXPORT static TopoDS_Shape GetShape(const TDF_Label& L);
0204 
0205   //! Gets shape from a sequence of shape's labels
0206   //! @param[in] theLabels a sequence of labels to get shapes from
0207   //! @return original shape in case of one label and a compound of shapes in case of more
0208   Standard_EXPORT static TopoDS_Shape GetOneShape(const NCollection_Sequence<TDF_Label>& theLabels);
0209 
0210   //! Gets shape from a sequence of all top-level shapes which are free
0211   //! @return original shape in case of one label and a compound of shapes in case of more
0212   Standard_EXPORT TopoDS_Shape GetOneShape() const;
0213 
0214   //! Creates new (empty) top-level shape.
0215   //! Initially it holds empty TopoDS_Compound
0216   Standard_EXPORT TDF_Label NewShape() const;
0217 
0218   //! Sets representation (TopoDS_Shape) for top-level shape.
0219   Standard_EXPORT void SetShape(const TDF_Label& L, const TopoDS_Shape& S);
0220 
0221   //! Adds a new top-level (creates and returns a new label)
0222   //! If makeAssembly is True, treats TopAbs_COMPOUND shapes
0223   //! as assemblies (creates assembly structure).
0224   //! NOTE: <makePrepare> replace components without location
0225   //! in assembly by located components to avoid some problems.
0226   //! If AutoNaming() is True then automatically attaches names.
0227   Standard_EXPORT TDF_Label AddShape(const TopoDS_Shape& S,
0228                                      const bool          makeAssembly = true,
0229                                      const bool          makePrepare  = true);
0230 
0231   //! Removes shape (whole label and all its sublabels)
0232   //! If removeCompletely is true, removes complete shape
0233   //! If removeCompletely is false, removes instance(location) only
0234   //! Returns False (and does nothing) if shape is not free
0235   //! or is not top-level shape
0236   Standard_EXPORT bool RemoveShape(const TDF_Label& L, const bool removeCompletely = true) const;
0237 
0238   //! set hasComponents into false
0239   Standard_EXPORT void Init();
0240 
0241   //! Sets auto-naming mode to <V>. If True then for added
0242   //! shapes, links, assemblies and SHUO's, the TDataStd_Name attribute
0243   //! is automatically added. For shapes it contains a shape type
0244   //! (e.g. "SOLID", "SHELL", etc); for links it has a form
0245   //! "=>[0:1:1:2]" (where a tag is a label containing a shape
0246   //! without a location); for assemblies it is "ASSEMBLY", and
0247   //! "SHUO" for SHUO's.
0248   //! This setting is global; it cannot be made a member function
0249   //! as it is used by static methods as well.
0250   //! By default, auto-naming is enabled.
0251   //! See also AutoNaming().
0252   Standard_EXPORT static void SetAutoNaming(const bool V);
0253 
0254   //! Returns current auto-naming mode. See SetAutoNaming() for
0255   //! description.
0256   Standard_EXPORT static bool AutoNaming();
0257 
0258   //! recursive
0259   Standard_EXPORT void ComputeShapes(const TDF_Label& L);
0260 
0261   //! Compute a sequence of simple shapes
0262   Standard_EXPORT void ComputeSimpleShapes();
0263 
0264   //! Returns a sequence of all top-level shapes
0265   Standard_EXPORT void GetShapes(NCollection_Sequence<TDF_Label>& Labels) const;
0266 
0267   //! Returns a sequence of all top-level shapes
0268   //! which are free (i.e. not referred by any other)
0269   Standard_EXPORT void GetFreeShapes(NCollection_Sequence<TDF_Label>& FreeLabels) const;
0270 
0271   //! Returns list of labels which refer shape L as component
0272   //! Returns number of users (0 if shape is free)
0273   Standard_EXPORT static int GetUsers(const TDF_Label&                 L,
0274                                       NCollection_Sequence<TDF_Label>& Labels,
0275                                       const bool                       getsubchilds = false);
0276 
0277   //! Returns location of instance
0278   Standard_EXPORT static TopLoc_Location GetLocation(const TDF_Label& L);
0279 
0280   //! Returns label which corresponds to a shape referred by L
0281   //! Returns False if label is not reference
0282   Standard_EXPORT static bool GetReferredShape(const TDF_Label& L, TDF_Label& Label);
0283 
0284   //! Returns number of Assembles components
0285   Standard_EXPORT static int NbComponents(const TDF_Label& L, const bool getsubchilds = false);
0286 
0287   //! Returns list of components of assembly
0288   //! Returns False if label is not assembly
0289   Standard_EXPORT static bool GetComponents(const TDF_Label&                 L,
0290                                             NCollection_Sequence<TDF_Label>& Labels,
0291                                             const bool                       getsubchilds = false);
0292 
0293   //! Adds a component given by its label and location to the assembly
0294   //! Note: assembly must be IsAssembly() or IsSimpleShape()
0295   Standard_EXPORT TDF_Label AddComponent(const TDF_Label&       assembly,
0296                                          const TDF_Label&       comp,
0297                                          const TopLoc_Location& Loc);
0298 
0299   //! Adds a shape (located) as a component to the assembly
0300   //! If necessary, creates an additional top-level shape for
0301   //! component and return the Label of component.
0302   //! If expand is True and component is Compound, it will
0303   //! be created as assembly also
0304   //! Note: assembly must be IsAssembly() or IsSimpleShape()
0305   Standard_EXPORT TDF_Label AddComponent(const TDF_Label&    assembly,
0306                                          const TopoDS_Shape& comp,
0307                                          const bool          expand = false);
0308 
0309   //! Removes a component from its assembly
0310   Standard_EXPORT void RemoveComponent(const TDF_Label& comp) const;
0311 
0312   //! Top-down update for all assembly compounds stored in the document.
0313   Standard_EXPORT void UpdateAssemblies();
0314 
0315   //! Finds a label for subshape <sub> of shape stored on
0316   //! label shapeL
0317   //! Returns Null label if it is not found
0318   Standard_EXPORT bool FindSubShape(const TDF_Label&    shapeL,
0319                                     const TopoDS_Shape& sub,
0320                                     TDF_Label&          L) const;
0321 
0322   //! Adds a label for subshape <sub> of shape stored on
0323   //! label shapeL
0324   //! Returns Null label if it is not subshape
0325   Standard_EXPORT TDF_Label AddSubShape(const TDF_Label& shapeL, const TopoDS_Shape& sub) const;
0326 
0327   //! Adds (of finds already existed) a label for subshape <sub> of shape stored on
0328   //! label shapeL. Label addedSubShapeL returns added (found) label or empty in case of wrong
0329   //! subshape. Returns True, if new shape was added, False in case of already existed
0330   //! subshape/wrong subshape
0331   Standard_EXPORT bool AddSubShape(const TDF_Label&    shapeL,
0332                                    const TopoDS_Shape& sub,
0333                                    TDF_Label&          addedSubShapeL) const;
0334 
0335   Standard_EXPORT TDF_Label FindMainShapeUsingMap(const TopoDS_Shape& sub) const;
0336 
0337   //! Performs a search among top-level shapes to find
0338   //! the shape containing <sub> as subshape
0339   //! Checks only simple shapes, and returns the first found
0340   //! label (which should be the only one for valid model)
0341   Standard_EXPORT TDF_Label FindMainShape(const TopoDS_Shape& sub) const;
0342 
0343   //! Returns list of labels identifying subshapes of the given shape
0344   //! Returns False if no subshapes are placed on that label
0345   Standard_EXPORT static bool GetSubShapes(const TDF_Label&                 L,
0346                                            NCollection_Sequence<TDF_Label>& Labels);
0347 
0348   //! returns the label under which shapes are stored
0349   Standard_EXPORT TDF_Label BaseLabel() const;
0350 
0351   Standard_EXPORT Standard_OStream& Dump(Standard_OStream& theDumpLog, const bool deep) const;
0352 
0353   Standard_EXPORT Standard_OStream& Dump(Standard_OStream& theDumpLog) const override;
0354 
0355   //! Print to std::ostream <theDumpLog> type of shape found on <L> label
0356   //! and the entry of <L>, with <level> tabs before.
0357   //! If <deep>, print also TShape and Location addresses
0358   Standard_EXPORT static void DumpShape(Standard_OStream& theDumpLog,
0359                                         const TDF_Label&  L,
0360                                         const int         level = 0,
0361                                         const bool        deep  = false);
0362 
0363   Standard_EXPORT const Standard_GUID& ID() const override;
0364 
0365   //! Returns True if the label is a label of external references, i.e.
0366   //! there are some reference on the no-step files, which are
0367   //! described in document only their names
0368   Standard_EXPORT static bool IsExternRef(const TDF_Label& L);
0369 
0370   //! Sets the names of references on the no-step files
0371   Standard_EXPORT TDF_Label
0372     SetExternRefs(const NCollection_Sequence<occ::handle<TCollection_HAsciiString>>& SHAS) const;
0373 
0374   //! Sets the names of references on the no-step files
0375   Standard_EXPORT void SetExternRefs(
0376     const TDF_Label&                                                   L,
0377     const NCollection_Sequence<occ::handle<TCollection_HAsciiString>>& SHAS) const;
0378 
0379   //! Gets the names of references on the no-step files
0380   Standard_EXPORT static void GetExternRefs(
0381     const TDF_Label&                                             L,
0382     NCollection_Sequence<occ::handle<TCollection_HAsciiString>>& SHAS);
0383 
0384   //! Sets the SHUO structure between upper_usage and next_usage
0385   //! create multy-level (if number of labels > 2) SHUO from first to last
0386   //! Initialise out <MainSHUOAttr> by main upper_usage SHUO attribute.
0387   //! Returns FALSE if some of labels in not component label
0388   Standard_EXPORT bool SetSHUO(const NCollection_Sequence<TDF_Label>& Labels,
0389                                occ::handle<XCAFDoc_GraphNode>&        MainSHUOAttr) const;
0390 
0391   //! Returns founded SHUO GraphNode attribute <aSHUOAttr>
0392   //! Returns false in other case
0393   Standard_EXPORT static bool GetSHUO(const TDF_Label&                SHUOLabel,
0394                                       occ::handle<XCAFDoc_GraphNode>& aSHUOAttr);
0395 
0396   //! Returns founded SHUO GraphNodes of indicated component
0397   //! Returns false in other case
0398   Standard_EXPORT static bool GetAllComponentSHUO(
0399     const TDF_Label&                                  CompLabel,
0400     NCollection_Sequence<occ::handle<TDF_Attribute>>& SHUOAttrs);
0401 
0402   //! Returns the sequence of labels of SHUO attributes,
0403   //! which is upper_usage for this next_usage SHUO attribute
0404   //! (that indicated by label)
0405   //! NOTE: returns upper_usages only on one level (not recurse)
0406   //! NOTE: do not clear the sequence before filling
0407   Standard_EXPORT static bool GetSHUOUpperUsage(const TDF_Label&                 NextUsageL,
0408                                                 NCollection_Sequence<TDF_Label>& Labels);
0409 
0410   //! Returns the sequence of labels of SHUO attributes,
0411   //! which is next_usage for this upper_usage SHUO attribute
0412   //! (that indicated by label)
0413   //! NOTE: returns next_usages only on one level (not recurse)
0414   //! NOTE: do not clear the sequence before filling
0415   Standard_EXPORT static bool GetSHUONextUsage(const TDF_Label&                 UpperUsageL,
0416                                                NCollection_Sequence<TDF_Label>& Labels);
0417 
0418   //! Remove SHUO from component sublabel,
0419   //! remove all dependencies on other SHUO.
0420   //! Returns FALSE if cannot remove SHUO dependencies.
0421   //! NOTE: remove any styles that associated with this SHUO.
0422   Standard_EXPORT bool RemoveSHUO(const TDF_Label& SHUOLabel) const;
0423 
0424   //! Search the path of labels in the document,
0425   //! that corresponds the component from any assembly
0426   //! Try to search the sequence of labels with location that
0427   //! produce this shape as component of any assembly
0428   //! NOTE: Clear sequence of labels before filling
0429   Standard_EXPORT bool FindComponent(const TopoDS_Shape&              theShape,
0430                                      NCollection_Sequence<TDF_Label>& Labels) const;
0431 
0432   //! Search for the component shape that styled by shuo
0433   //! Returns null shape if no any shape is found.
0434   Standard_EXPORT TopoDS_Shape GetSHUOInstance(const occ::handle<XCAFDoc_GraphNode>& theSHUO) const;
0435 
0436   //! Search for the component shape by labelks path
0437   //! and set SHUO structure for founded label structure
0438   //! Returns null attribute if no component in any assembly found.
0439   Standard_EXPORT occ::handle<XCAFDoc_GraphNode> SetInstanceSHUO(
0440     const TopoDS_Shape& theShape) const;
0441 
0442   //! Searching for component shapes that styled by shuo
0443   //! Returns empty sequence of shape if no any shape is found.
0444   Standard_EXPORT bool GetAllSHUOInstances(
0445     const occ::handle<XCAFDoc_GraphNode>& theSHUO,
0446     NCollection_Sequence<TopoDS_Shape>&   theSHUOShapeSeq) const;
0447 
0448   //! Searches the SHUO by labels of components
0449   //! from upper_usage component to next_usage
0450   //! Returns null attribute if no SHUO found
0451   Standard_EXPORT static bool FindSHUO(const NCollection_Sequence<TDF_Label>& Labels,
0452                                        occ::handle<XCAFDoc_GraphNode>&        theSHUOAttr);
0453 
0454   //! Sets location to the shape label
0455   //! If label is reference -> changes location attribute
0456   //! If label is free shape -> creates reference with location to it
0457   //! @param[in] theShapeLabel the shape label to change location
0458   //! @param[in] theLoc location to set
0459   //! @param[out] theRefLabel the reference label with new location
0460   //! @return TRUE if new location was set
0461   Standard_EXPORT bool SetLocation(const TDF_Label&       theShapeLabel,
0462                                    const TopLoc_Location& theLoc,
0463                                    TDF_Label&             theRefLabel);
0464 
0465   //! Convert Shape (compound/compsolid/shell/wire) to assembly
0466   Standard_EXPORT bool Expand(const TDF_Label& Shape);
0467 
0468   //! Method to get NamedData attribute assigned to the given shape label.
0469   //! @param[in] theLabel     the shape Label
0470   //! @param[in] theToCreate  create and assign attribute if it doesn't exist
0471   //! @return Handle to the NamedData attribute or Null if there is none
0472   Standard_EXPORT occ::handle<TDataStd_NamedData> GetNamedProperties(
0473     const TDF_Label& theLabel,
0474     const bool       theToCreate = false) const;
0475 
0476   //! Method to get NamedData attribute assigned to a label of the given shape.
0477   //! @param[in] theShape     input shape
0478   //! @param[in] theToCreate  create and assign attribute if it doesn't exist
0479   //! @return Handle to the NamedData attribute or Null if there is none
0480   Standard_EXPORT occ::handle<TDataStd_NamedData> GetNamedProperties(
0481     const TopoDS_Shape& theShape,
0482     const bool          theToCreate = false) const;
0483 
0484   //! Dumps the content of me into the stream
0485   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const override;
0486 
0487   DEFINE_DERIVED_ATTRIBUTE(XCAFDoc_ShapeTool, TDataStd_GenericEmpty)
0488 
0489 private:
0490   //! Checks recursively if the given assembly item is modified. If so, its
0491   //! associated compound is updated. Returns true if the assembly item is
0492   //! modified, false -- otherwise.
0493   Standard_EXPORT bool updateComponent(const TDF_Label&            theAssmLabel,
0494                                        TopoDS_Shape&               theUpdatedShape,
0495                                        NCollection_Map<TDF_Label>& theUpdated) const;
0496 
0497   //! Adds a new top-level (creates and returns a new label)
0498   //! For internal use. Used by public method AddShape.
0499   Standard_EXPORT TDF_Label addShape(const TopoDS_Shape& S, const bool makeAssembly = true);
0500 
0501   //! Makes a shape on label L to be a reference to shape refL
0502   //! with location loc
0503   Standard_EXPORT static void MakeReference(const TDF_Label&       L,
0504                                             const TDF_Label&       refL,
0505                                             const TopLoc_Location& loc);
0506 
0507   //! Auxiliary method for Expand
0508   //! Add declared under expanded theMainShapeL subshapes to new part label thePart
0509   //! Recursively iterate all subshapes of shape from thePart, current shape to iterate its
0510   //! subshapes is theShape.
0511   Standard_EXPORT void makeSubShape(const TDF_Label&       theMainShapeL,
0512                                     const TDF_Label&       thePart,
0513                                     const TopoDS_Shape&    theShape,
0514                                     const TopLoc_Location& theLoc);
0515 
0516   NCollection_DataMap<TopoDS_Shape, TDF_Label, TopTools_ShapeMapHasher> myShapeLabels;
0517   NCollection_DataMap<TopoDS_Shape, TDF_Label, TopTools_ShapeMapHasher> mySubShapes;
0518   NCollection_DataMap<TopoDS_Shape, TDF_Label, TopTools_ShapeMapHasher> mySimpleShapes;
0519   bool                                                                  hasSimpleShapes;
0520 };
0521 
0522 #endif // _XCAFDoc_ShapeTool_HeaderFile