42cf5bc1 |
1 | // Created by: DAUTRY Philippe |
2 | // Copyright (c) 1997-1999 Matra Datavision |
3 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
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. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef _TDF_CopyTool_HeaderFile |
17 | #define _TDF_CopyTool_HeaderFile |
18 | |
19 | #include <Standard.hxx> |
20 | #include <Standard_DefineAlloc.hxx> |
21 | #include <Standard_Handle.hxx> |
22 | |
23 | #include <Standard_Boolean.hxx> |
24 | #include <TDF_LabelDataMap.hxx> |
25 | #include <TDF_AttributeDataMap.hxx> |
26 | #include <TDF_LabelMap.hxx> |
27 | #include <TDF_AttributeMap.hxx> |
28 | class TDF_DataSet; |
29 | class TDF_RelocationTable; |
30 | class TDF_IDFilter; |
31 | class TDF_Label; |
32 | |
33 | |
34 | //! This class provides services to build, copy or |
35 | //! paste a set of information. |
36 | //! |
37 | //! Copy methods: |
38 | //! ------------- |
39 | //! |
40 | //! * Copy(aSourceDataSet, aTargetLabel, |
41 | //! aRelocationTable) copies a source DataSet under |
42 | //! its target place (see below: IMPORTANT NOTICE 1). |
43 | //! |
44 | //! * Copy(aSourceDataSet, anTargetLabel, |
45 | //! aRelocationTable, aFilter) does the same job as |
46 | //! the previous method. But <aFilter> gives a list of |
47 | //! IDs for which a target attribute prevails over a |
48 | //! source one. In this special case, the source |
49 | //! attribute will be copied only if there will be no |
50 | //! target attribute. |
51 | //! |
52 | //! IMPORTANT NOTICE : Label pre-binding |
53 | //! ------------------ |
54 | //! |
55 | //! For it is possible to copy root labels in another |
56 | //! place in the same Data or in a different one with |
57 | //! other tags, it is necessary to inform the Copy |
58 | //! algorithm about the target place. To do so: |
59 | //! |
60 | //! * first get or create new target root labels; |
61 | //! |
62 | //! * then bind them with the source root labels using |
63 | //! the relocation table method: |
64 | //! SetRelocation(aSourceLabel, aTargetLabel); |
65 | //! |
66 | //! * finally call Copy(...) with the relocation table |
67 | //! previously set. In this way, this method will take |
68 | //! these relocations in account. |
69 | class TDF_CopyTool |
70 | { |
71 | public: |
72 | |
73 | DEFINE_STANDARD_ALLOC |
74 | |
75 | |
76 | //! Copy <aSourceDataSet> with using and updating |
77 | //! <aRelocationTable>. This method ignores target |
78 | //! attributes privilege over source ones. |
79 | Standard_EXPORT static void Copy (const Handle(TDF_DataSet)& aSourceDataSet, const Handle(TDF_RelocationTable)& aRelocationTable); |
80 | |
81 | //! Copy <aSourceDataSet> using and updating |
82 | //! <aRelocationTable>. Use <aPrivilegeFilter> to give |
83 | //! a list of IDs for which the target attribute |
84 | //! prevails over the source one. |
85 | Standard_EXPORT static void Copy (const Handle(TDF_DataSet)& aSourceDataSet, const Handle(TDF_RelocationTable)& aRelocationTable, const TDF_IDFilter& aPrivilegeFilter); |
86 | |
87 | //! Copy <aSourceDataSet> using and updating |
88 | //! <aRelocationTable>. Use <aPrivilegeFilter> to give |
89 | //! a list of IDs for which the target attribute |
90 | //! prevails over the source one. If |
91 | //! <setSelfContained> is set to true, every |
92 | //! TDF_Reference will be replaced by the referenced |
93 | //! structure according to <aRefFilter>. |
94 | //! |
95 | //! NB: <aRefFilter> is used only if |
96 | //! <setSelfContained> is true. |
97 | //! Internal root label copy recursive method. |
98 | Standard_EXPORT static void Copy (const Handle(TDF_DataSet)& aSourceDataSet, const Handle(TDF_RelocationTable)& aRelocationTable, const TDF_IDFilter& aPrivilegeFilter, const TDF_IDFilter& aRefFilter, const Standard_Boolean setSelfContained); |
99 | |
100 | |
101 | |
102 | |
103 | protected: |
104 | |
105 | |
106 | |
107 | |
108 | |
109 | private: |
110 | |
111 | |
112 | //! Internal root label copy recursive method. |
113 | Standard_EXPORT static void CopyLabels (const TDF_Label& aSLabel, TDF_Label& aTargetLabel, TDF_LabelDataMap& aLabMap, TDF_AttributeDataMap& aAttMap, const TDF_LabelMap& aSrcLabelMap, const TDF_AttributeMap& aSrcAttributeMap); |
114 | |
115 | //! Internal attribute copy method. |
116 | Standard_EXPORT static void CopyAttributes (const TDF_Label& aSLabel, TDF_Label& aTargetLabel, TDF_AttributeDataMap& aAttMap, const TDF_AttributeMap& aSrcAttributeMap); |
117 | |
118 | |
119 | |
120 | |
121 | }; |
122 | |
123 | |
124 | |
125 | |
126 | |
127 | |
128 | |
129 | #endif // _TDF_CopyTool_HeaderFile |