0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / TDocStd / TDocStd_XLinkTool.hxx
CommitLineData
42cf5bc1 1// Created on: 1998-05-12
2// Created by: Isabelle GRIGNON
3// Copyright (c) 1998-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _TDocStd_XLinkTool_HeaderFile
18#define _TDocStd_XLinkTool_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <Standard_Boolean.hxx>
25class TDF_DataSet;
26class TDF_RelocationTable;
27class TDF_Label;
28
29
30//! This tool class is used to copy the content of
31//! source label under target label. Only child
32//! labels and attributes of source are copied.
33//! attributes located out of source scope are not
34//! copied by this algorithm.
35//! Depending of the called method an external
36//! reference is set in the the target document to
37//! registred the externallink.
38//! Provide services to set, update and perform
39//! external references.
40//! Warning1: Nothing is provided in this class about the
41//! opportunity to copy, set a link or update it.
42//! Such decisions must be under application control.
43//! Warning2: If the document manages shapes, use after copy
44//! TNaming::ChangeShapes(target,M) to make copy of
45//! shapes.
46class TDocStd_XLinkTool
47{
48public:
49
50 DEFINE_STANDARD_ALLOC
51
52
53 Standard_EXPORT TDocStd_XLinkTool();
54
55 //! Copies the content of the label <fromsource> to the label <intarget>.
56 //! The link is registred with an XLink attribute by <intarget>
57 //! label. if the content of <fromsource> is not
58 //! self-contained, and/or <intarget> has already an XLink
59 //! attribute, an exception is raised.
60 Standard_EXPORT void CopyWithLink (const TDF_Label& intarget, const TDF_Label& fromsource);
61
62 //! Update the external reference set at <L>.
63 //! Example
64 //! Handle(TDocStd_Document) aDoc;
65 //! if
66 //! (!OCAFTest::GetDocument(1,aDoc)) return 1;
67 //! Handle(TDataStd_Reference) aRef;
68 //! TDocStd_XLinkTool xlinktool;
69 //! if
70 //! (!OCAFTest::Find(aDoc,2),TDataStd_Reference::GetID(),aRef) return 1;
71 //! xlinktool.UpdateLink(aRef->Label());
72 //! Exceptions
73 //! Standard_DomainError if <L> has no XLink attribute.
74 Standard_EXPORT void UpdateLink (const TDF_Label& L);
75
76 //! Copy the content of <fromsource> under
77 //! <intarget>. Noone link is registred. noone check is done.
78 //! Example
79 //! Handle(TDocStd_Document) DOC, XDOC;
80 //! TDF_Label L, XL;
81 //! TDocStd_XLinkTool xlinktool;
82 //! xlinktool.Copy(L,XL);
83 //! Exceptions:
84 //! Standard_DomainError if the contents of
85 //! fromsource are not entirely in the scope of this
86 //! label, in other words, are not self-contained.
87 //! !!! ==> Warning:
88 //! If the document manages shapes use the next way:
89 //! TDocStd_XLinkTool xlinktool;
90 //! xlinktool.Copy(L,XL);
91 //! TopTools_DataMapOfShapeShape M;
92 //! TNaming::ChangeShapes(target,M);
93 Standard_EXPORT virtual void Copy (const TDF_Label& intarget, const TDF_Label& fromsource);
94
95 Standard_EXPORT Standard_Boolean IsDone() const;
96
97 Standard_EXPORT Handle(TDF_DataSet) DataSet() const;
98
99 Standard_EXPORT Handle(TDF_RelocationTable) RelocationTable() const;
100
101
102
103
104protected:
105
106
107
108 Standard_Boolean isDone;
109
110
111private:
112
113
114
115 Handle(TDF_DataSet) myDS;
116 Handle(TDF_RelocationTable) myRT;
117
118
119};
120
121
122
123
124
125
126
127#endif // _TDocStd_XLinkTool_HeaderFile