1 // Created on: 2015-05-14
2 // Created by: Ilya Novikov
3 // Copyright (c) 2000-2015 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _XCAFDoc_Editor_HeaderFile
17 #define _XCAFDoc_Editor_HeaderFile
19 #include <Standard_DefineAlloc.hxx>
20 #include <TDataStd_Name.hxx>
21 #include <TDF_AttributeMap.hxx>
22 #include <TDF_Label.hxx>
23 #include <TDF_LabelDataMap.hxx>
24 #include <TDF_LabelSequence.hxx>
26 class XCAFDoc_VisMaterial;
27 class XCAFDoc_ShapeTool;
29 //! Tool for edit structure of document.
36 //! Converts shape (compound/compsolid/shell/wire) to assembly.
37 //! @param[in] theDoc input document
38 //! @param[in] theShape input shape label
39 //! @param[in] theRecursively recursively expand a compound subshape
40 //! @return True if shape successfully expanded
41 Standard_EXPORT static Standard_Boolean Expand(const TDF_Label& theDoc,
42 const TDF_Label& theShape,
43 const Standard_Boolean theRecursively = Standard_True);
45 //! Converts all compounds shapes in the document to assembly
46 //! @param[in] theDoc input document
47 //! @param[in] theShape input shape label
48 //! @param[in] theRecursively recursively expand a compound subshape
49 //! @return True if shape successfully expanded
50 Standard_EXPORT static Standard_Boolean Expand(const TDF_Label& theDoc,
51 const Standard_Boolean theRecursively = Standard_True);
53 //! Clones all labels to a new position, keeping the structure with all the attributes
54 //! @param[in] theSrcLabels original labels to copy from
55 //! @param[in] theDstLabel label to set result as a component of or a main document's label to simply set new shape
56 //! @param[in] theIsNoVisMat get a VisMaterial attributes as is or convert to color
57 //! @return True if shape successfully extracted
58 Standard_EXPORT static Standard_Boolean Extract(const TDF_LabelSequence& theSrcLabels,
59 const TDF_Label& theDstLabel,
60 const Standard_Boolean theIsNoVisMat = Standard_False);
62 //! Clones the label to a new position, keeping the structure with all the attributes
63 //! @param[in] theSrcLabel original label to copy from
64 //! @param[in] theDstLabel label to set result as a component of or a main document's label to simply set new shape
65 //! @param[in] theIsNoVisMat get a VisMaterial attributes as is or convert to color
66 //! @return True if shape successfully extracted
67 Standard_EXPORT static Standard_Boolean Extract(const TDF_Label& theSrcLabel,
68 const TDF_Label& theDstLabel,
69 const Standard_Boolean theIsNoVisMat = Standard_False);
71 //! Copies shapes label with keeping of shape structure (recursively)
72 //! @param[in] theSrcLabel original label to copy from
73 //! @param[in] theSrcShapeTool shape tool to get
74 //! @param[in] theDstShapeTool shape tool to set
75 //! @param[out] theMap relating map of the original shapes label and labels created from them
76 //! @return result shape label
77 Standard_EXPORT static TDF_Label CloneShapeLabel(const TDF_Label& theSrcLabel,
78 const Handle(XCAFDoc_ShapeTool)& theSrcShapeTool,
79 const Handle(XCAFDoc_ShapeTool)& theDstShapeTool,
80 TDF_LabelDataMap& theMap);
82 //! Copies metadata contains from the source label to the destination label.
83 //! Protected against creating a new label for non-existent tools
84 //! @param[in] theSrcLabel original label to copy from
85 //! @param[in] theDstLabel destination shape label to set attributes
86 //! @param[in] theVisMatMap relating map of the original VisMaterial and created. Can be NULL for the same document
87 //! @param[in] theToCopyColor copying visible value and shape color (handled all color type)
88 //! @param[in] theToCopyLayer copying layer
89 //! @param[in] theToCopyMaterial copying material
90 //! @param[in] theToCopyVisMaterial copying visual material
91 //! @param[in] theToCopyAttributes copying of other node attributes, for example, a shape's property
92 Standard_EXPORT static void CloneMetaData(const TDF_Label& theSrcLabel,
93 const TDF_Label& theDstLabel,
94 NCollection_DataMap<Handle(XCAFDoc_VisMaterial), Handle(XCAFDoc_VisMaterial)>* theVisMatMap,
95 const Standard_Boolean theToCopyColor = Standard_True,
96 const Standard_Boolean theToCopyLayer = Standard_True,
97 const Standard_Boolean theToCopyMaterial = Standard_True,
98 const Standard_Boolean theToCopyVisMaterial = Standard_True,
99 const Standard_Boolean theToCopyAttributes = Standard_True);
103 #endif // _XCAFDoc_Editor_HeaderFile