1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
// File: DDocStd_ToolsCommands.cxx
// Created: Wed Mar 1 14:07:43 2000
// Author: Denis PASCAL
// <dp@dingox.paris1.matra-dtv.fr>
#include <DDocStd.hxx>
#include <Draw.hxx>
#include <Draw_Interpretor.hxx>
#include <TDocStd_Document.hxx>
#include <TDF_Label.hxx>
#include <TCollection_AsciiString.hxx>
#include <TDF_Tool.hxx>
#include <TDF_ListIteratorOfAttributeDeltaList.hxx>
#include <TDF_AttributeDelta.hxx>
#include <TDF_Delta.hxx>
#include <TDF_AttributeDelta.hxx>
#include <TDF_DeltaOnAddition.hxx>
#include <TDF_DeltaOnForget.hxx>
#include <TDF_DeltaOnResume.hxx>
#include <TDF_DeltaOnRemoval.hxx>
#include <TDF_DeltaOnModification.hxx>
#include <TDF_AttributeDeltaList.hxx>
#include <TDF_ListIteratorOfAttributeDeltaList.hxx>
#include <Standard_DomainError.hxx>
//=======================================================================
//function : UpdateXLinks
//=======================================================================
static Standard_Integer DDocStd_UpdateXLinks(Draw_Interpretor& /*di*/,Standard_Integer n, const char** a)
{
if (n < 3) return 1;
Handle(TDocStd_Document) D;
if (!DDocStd::GetDocument(a[1],D)) return 1;
TCollection_AsciiString Entry(a[2]);
D->UpdateReferences(Entry);
// DDocStd::DisplayModified(a[1]);
return 0;
}
//=======================================================================
//function : DDocStd_DumpCommand
//purpose : DumpDocument (DOC)
//=======================================================================
static Standard_Integer DDocStd_DumpCommand (Draw_Interpretor& di,
Standard_Integer nb,
const char** arg)
{
if (nb == 2) {
Handle(TDocStd_Document) D;
if (!DDocStd::GetDocument(arg[1],D)) return 1;
//
TDF_AttributeDeltaList added, forgoten, resumed, removed, modified;
Handle(TDF_AttributeDelta) AD;
if (D->GetUndos().IsEmpty()) {
di << "no UNDO available" << "\n";
return 0;
}
Handle(TDF_Delta) DELTA = D->GetUndos().Last();
TDF_ListIteratorOfAttributeDeltaList it (DELTA->AttributeDeltas());
for (;it.More();it.Next()) {
AD = it.Value();
if (AD->IsKind(STANDARD_TYPE(TDF_DeltaOnAddition))) {added.Append(AD);}
else if (AD->IsKind(STANDARD_TYPE(TDF_DeltaOnForget))) {forgoten.Append(AD);}
else if (AD->IsKind(STANDARD_TYPE(TDF_DeltaOnResume))) {resumed.Append(AD);}
else if (AD->IsKind(STANDARD_TYPE(TDF_DeltaOnRemoval))) {removed.Append(AD);}
else if (AD->IsKind(STANDARD_TYPE(TDF_DeltaOnModification))) {modified.Append(AD);}
else {
Standard_DomainError::Raise("DDocStd_DumpCommand : unknown delta");
}
}
//
TCollection_AsciiString string;
//
TCollection_AsciiString name; // (D->Name());
di << "ADDED :";
it.Initialize(added);
if (it.More()) di << "\n";
else di << " empty" << "\n";
for (;it.More();it.Next()) {
TDF_Tool::Entry (it.Value()->Label(),string);
di << "- " << string.ToCString() << " ";
di << it.Value()->Attribute()->DynamicType()->Name();
di << "\n";
}
//
// forgoten
di << "FORGOTEN :";
it.Initialize(forgoten);
if (it.More()) di << "\n";
else di << " empty" << "\n";
for (;it.More();it.Next()) {
TDF_Tool::Entry (it.Value()->Label(),string);
di << "- " << string.ToCString() << " ";
di << it.Value()->Attribute()->DynamicType()->Name();
di << "\n";
}
//
// resumed
di << "RESUMED :";
it.Initialize(resumed);
if (it.More()) di << "\n";
else di << " empty" << "\n";
for (;it.More();it.Next()) {
TDF_Tool::Entry (it.Value()->Label(),string);
di << "- " << string.ToCString() << " ";
di << it.Value()->Attribute()->DynamicType()->Name();
di << "\n";
}
//
// removed
di << "REMOVED :";
it.Initialize(removed);
if (it.More()) di << "\n";
else di << " empty" << "\n";
for (;it.More();it.Next()) {
TDF_Tool::Entry (it.Value()->Label(),string);
di << "- " << string.ToCString() << " ";
di << it.Value()->Attribute()->DynamicType()->Name();
di << "\n";
}
//
// modified
di << "MODIFIED :";
it.Initialize(modified);
if (it.More()) di << "\n";
else di << " empty" << "\n";
for (;it.More();it.Next()) {
TDF_Tool::Entry (it.Value()->Label(),string);
di << "- " << string.ToCString() << " ";
di << it.Value()->Attribute()->DynamicType()->Name();
di << "\n";
}
return 0;
}
di << "TDocStd_DumpCommand : Error" << "\n";
return 1;
}
//=======================================================================
//function : ModificationCommands
//purpose :
//=======================================================================
void DDocStd::ToolsCommands(Draw_Interpretor& theCommands)
{
static Standard_Boolean done = Standard_False;
if (done) return;
done = Standard_True;
const char* g = "DDocStd commands";
theCommands.Add("UpdateXLinks","UpdateXLinks DocName DocEntry",
__FILE__, DDocStd_UpdateXLinks, g);
theCommands.Add ("DumpCommand",
"DumpCommand (DOC)",
__FILE__, DDocStd_DumpCommand, g);
}
|