b311480e |
1 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
2 | // |
3 | // The content of this file is subject to the Open CASCADE Technology Public |
4 | // License Version 6.5 (the "License"). You may not use the content of this file |
5 | // except in compliance with the License. Please obtain a copy of the License |
6 | // at http://www.opencascade.org and read it completely before using this file. |
7 | // |
8 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
9 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
10 | // |
11 | // The Original Code and all software distributed under the License is |
12 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
13 | // Initial Developer hereby disclaims all such warranties, including without |
14 | // limitation, any warranties of merchantability, fitness for a particular |
15 | // purpose or non-infringement. Please see the License for the specific terms |
16 | // and conditions governing the rights and limitations under the License. |
17 | |
7fd59977 |
18 | #include <IGESData_GeneralModule.ixx> |
19 | #include <Interface_GeneralLib.hxx> |
20 | #include <IGESData.hxx> |
21 | #include <IGESData_Protocol.hxx> |
22 | #include <IGESData_IGESEntity.hxx> |
23 | #include <TCollection_HAsciiString.hxx> |
24 | #include <Interface_Macros.hxx> |
25 | |
26 | |
27 | |
28 | |
b311480e |
29 | void IGESData_GeneralModule::FillSharedCase |
7fd59977 |
30 | (const Standard_Integer CN, const Handle(Standard_Transient)& ent, |
31 | Interface_EntityIterator& iter) const |
32 | { |
33 | DeclareAndCast(IGESData_IGESEntity,anent,ent); |
34 | if (anent.IsNull()) return; |
35 | // .... Directory Part |
36 | iter.AddItem (anent->DirFieldEntity (3)); |
37 | iter.AddItem (anent->DirFieldEntity (4)); |
38 | iter.AddItem (anent->DirFieldEntity (5)); |
39 | iter.AddItem (anent->DirFieldEntity (6)); |
40 | iter.AddItem (anent->DirFieldEntity (7)); |
41 | iter.AddItem (anent->DirFieldEntity (8)); |
42 | iter.AddItem (anent->DirFieldEntity (13)); |
43 | |
44 | // .... Own Parameters |
45 | OwnSharedCase (CN,anent,iter); |
46 | |
47 | // .... Properties |
48 | Interface_EntityIterator assocs = anent->Properties(); |
49 | for (; assocs.More(); assocs.Next()) iter.AddItem (assocs.Value()); |
50 | } |
51 | |
52 | void IGESData_GeneralModule::ListImpliedCase |
53 | (const Standard_Integer CN, const Handle(Standard_Transient)& ent, |
54 | Interface_EntityIterator& iter) const |
55 | { |
56 | DeclareAndCast(IGESData_IGESEntity,anent,ent); |
57 | if (anent.IsNull()) return; |
58 | OwnImpliedCase (CN,anent,iter); |
59 | Interface_EntityIterator assocs = anent->Associativities(); |
60 | for (; assocs.More(); assocs.Next()) iter.AddItem (assocs.Value()); |
61 | } |
62 | |
63 | |
64 | void IGESData_GeneralModule::OwnImpliedCase |
65 | (const Standard_Integer , const Handle(IGESData_IGESEntity)& , |
66 | Interface_EntityIterator& ) const |
67 | { } // par defaut, rien (redefinissable) |
68 | |
69 | |
70 | |
71 | void IGESData_GeneralModule::CheckCase |
72 | (const Standard_Integer CN, const Handle(Standard_Transient)& ent, |
73 | const Interface_ShareTool& shares, Handle(Interface_Check)& ach) const |
74 | { |
75 | DeclareAndCast(IGESData_IGESEntity,anent,ent); |
76 | |
77 | IGESData_DirChecker dc = DirChecker(CN,anent); |
78 | dc.Check(ach,anent); |
79 | OwnCheckCase (CN,anent,shares,ach); |
80 | } |
81 | |
82 | |
83 | Standard_Boolean IGESData_GeneralModule::CanCopy |
35e08fe8 |
84 | (const Standard_Integer /*CN*/, const Handle(Standard_Transient)& /*ent*/) const |
7fd59977 |
85 | { return Standard_True; } |
86 | |
87 | void IGESData_GeneralModule::CopyCase |
88 | (const Standard_Integer CN, const Handle(Standard_Transient)& entfrom, |
89 | const Handle(Standard_Transient)& entto, Interface_CopyTool& TC) const |
90 | { |
91 | DeclareAndCast(IGESData_IGESEntity,ento,entto); |
92 | DeclareAndCast(IGESData_IGESEntity,enfr,entfrom); |
93 | //// ento->Clear(); |
94 | |
95 | // ... Reprendre entete ... |
96 | //? ento->InitTypeAndForm (enfr->TypeNumber(), enfr->FormNumber());ShallowCopy |
97 | |
98 | if (enfr->DefLineFont() == IGESData_DefReference) ento->InitLineFont |
99 | (GetCasted(IGESData_LineFontEntity, TC.Transferred(enfr->LineFont()))); |
100 | else ento->InitLineFont (enfr->LineFont() , enfr->RankLineFont()); |
101 | |
102 | if (enfr->DefLevel() == IGESData_DefSeveral) ento->InitLevel |
103 | (GetCasted(IGESData_LevelListEntity,TC.Transferred(enfr->LevelList())),-1); |
104 | else ento->InitLevel (enfr->LevelList() , enfr->Level()); |
105 | |
106 | if (enfr->DefView() != IGESData_DefNone) ento->InitView |
107 | (GetCasted(IGESData_ViewKindEntity, TC.Transferred(enfr->View()))); |
108 | |
109 | if (enfr->HasTransf()) ento->InitTransf |
110 | (GetCasted(IGESData_TransfEntity, TC.Transferred(enfr->Transf()))); |
111 | |
112 | ento->InitStatus (enfr->BlankStatus() , |
113 | enfr->SubordinateStatus() , |
114 | enfr->UseFlag() , |
115 | enfr->HierarchyStatus() ); |
116 | |
117 | if (enfr->DefColor() == IGESData_DefReference) ento->InitColor |
118 | (GetCasted(IGESData_ColorEntity,TC.Transferred(enfr->Color()))); |
119 | else ento->InitColor (enfr->Color() , enfr->RankColor()); |
120 | |
121 | if (enfr->HasShortLabel()) ento->SetLabel |
122 | (new TCollection_HAsciiString(enfr->ShortLabel()), |
123 | enfr->SubScriptNumber()); |
124 | else ento->SetLabel (enfr->ShortLabel() , enfr->SubScriptNumber()); |
125 | |
126 | // Directory Part : Miscellaneous |
127 | Handle(IGESData_IGESEntity) Structure; |
128 | if (enfr->HasStructure()) Structure = |
129 | GetCasted(IGESData_IGESEntity, TC.Transferred(enfr->Structure())); |
130 | if (enfr->HasLabelDisplay()) ento->InitMisc |
131 | (Structure, |
132 | GetCasted(IGESData_LabelDisplayEntity,TC.Transferred(enfr->LabelDisplay())), |
133 | enfr->LineWeightNumber()); |
134 | else ento->InitMisc |
135 | (Structure , enfr->LabelDisplay() , enfr->LineWeightNumber()); |
136 | |
137 | // LineWeightValue, Res1, Res2 : through action of ShallowCopy ? |
138 | |
139 | OwnCopyCase (CN,enfr,ento,TC); |
140 | |
141 | // .. Properties |
142 | if (enfr->NbProperties() != 0) { |
143 | for (Interface_EntityIterator iter = enfr->Properties(); |
144 | iter.More(); iter.Next()) { |
145 | ento->AddProperty |
146 | (GetCasted(IGESData_IGESEntity,TC.Transferred(iter.Value()))); |
147 | } |
148 | } |
149 | } |
150 | |
151 | void IGESData_GeneralModule::RenewImpliedCase |
152 | (const Standard_Integer CN, const Handle(Standard_Transient)& entfrom, |
153 | const Handle(Standard_Transient)& entto, const Interface_CopyTool& TC) const |
154 | { |
155 | DeclareAndCast(IGESData_IGESEntity,ento,entto); |
156 | DeclareAndCast(IGESData_IGESEntity,enfr,entfrom); |
157 | |
158 | OwnRenewCase (CN,enfr,ento,TC); |
159 | |
160 | // .. Associativities |
161 | if (enfr->NbAssociativities() != 0) { |
162 | for (Interface_EntityIterator iter = enfr->Associativities(); |
163 | iter.More(); iter.Next()) { |
164 | Handle(Standard_Transient) anent = iter.Value(); |
165 | Handle(Standard_Transient) newent; |
166 | if (TC.Search(anent,newent)) ento->AddAssociativity |
167 | (GetCasted(IGESData_IGESEntity,newent)); |
168 | } |
169 | } |
170 | } |
171 | |
172 | void IGESData_GeneralModule::OwnRenewCase |
173 | (const Standard_Integer , const Handle(IGESData_IGESEntity)& , |
174 | const Handle(IGESData_IGESEntity)& , const Interface_CopyTool& ) const |
175 | { } |
176 | |
177 | void IGESData_GeneralModule::WhenDeleteCase |
178 | (const Standard_Integer CN, const Handle(Standard_Transient)& ent, |
179 | const Standard_Boolean ) const // dispatched : ignored |
180 | { |
181 | DeclareAndCast(IGESData_IGESEntity,anent,ent); |
182 | if (anent.IsNull()) return; |
183 | anent->Clear(); |
184 | OwnDeleteCase (CN,anent); |
185 | } |
186 | |
187 | void IGESData_GeneralModule::OwnDeleteCase |
188 | (const Standard_Integer , const Handle(IGESData_IGESEntity)& ) const |
189 | { } // par defaut, rien (redefinissable) |
190 | |
191 | |
192 | Handle(TCollection_HAsciiString) IGESData_GeneralModule::Name |
193 | (const Standard_Integer , const Handle(Standard_Transient)& ent, |
194 | const Interface_ShareTool& ) const |
195 | { |
196 | Handle(TCollection_HAsciiString) name; |
197 | DeclareAndCast(IGESData_IGESEntity,anent,ent); |
198 | if (anent.IsNull()) return name; |
199 | name = anent->NameValue (); |
200 | return name; |
201 | } |