summaryrefslogtreecommitdiff
path: root/src/IGESData/IGESData_GeneralModule.cxx
blob: 6ebc65231280bd2dd2616a5a1fab1e03ac92409e (plain)
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#include <IGESData_GeneralModule.ixx>
#include <Interface_GeneralLib.hxx>
#include <IGESData.hxx>
#include <IGESData_Protocol.hxx>
#include <IGESData_IGESEntity.hxx>
#include <TCollection_HAsciiString.hxx>
#include <Interface_Macros.hxx>




    void  IGESData_GeneralModule::FillSharedCase
  (const Standard_Integer CN, const Handle(Standard_Transient)& ent,
   Interface_EntityIterator& iter) const 
{
  DeclareAndCast(IGESData_IGESEntity,anent,ent);
  if (anent.IsNull()) return;
//  .... Directory Part
  iter.AddItem (anent->DirFieldEntity (3));
  iter.AddItem (anent->DirFieldEntity (4));
  iter.AddItem (anent->DirFieldEntity (5));
  iter.AddItem (anent->DirFieldEntity (6));
  iter.AddItem (anent->DirFieldEntity (7));
  iter.AddItem (anent->DirFieldEntity (8));
  iter.AddItem (anent->DirFieldEntity (13));

//  .... Own Parameters
  OwnSharedCase (CN,anent,iter);

//  .... Properties
  Interface_EntityIterator assocs = anent->Properties();
  for (; assocs.More(); assocs.Next())  iter.AddItem (assocs.Value());
}

    void  IGESData_GeneralModule::ListImpliedCase
  (const Standard_Integer CN, const Handle(Standard_Transient)& ent,
   Interface_EntityIterator& iter) const
{
  DeclareAndCast(IGESData_IGESEntity,anent,ent);
  if (anent.IsNull()) return;
  OwnImpliedCase (CN,anent,iter);
  Interface_EntityIterator assocs = anent->Associativities();
  for (; assocs.More(); assocs.Next())  iter.AddItem (assocs.Value());
}


    void  IGESData_GeneralModule::OwnImpliedCase
  (const Standard_Integer , const Handle(IGESData_IGESEntity)& ,
   Interface_EntityIterator& ) const 
      {  }  // par defaut, rien  (redefinissable)



    void  IGESData_GeneralModule::CheckCase
  (const Standard_Integer CN, const Handle(Standard_Transient)& ent,
   const Interface_ShareTool& shares, Handle(Interface_Check)& ach) const
{
  DeclareAndCast(IGESData_IGESEntity,anent,ent);

  IGESData_DirChecker dc = DirChecker(CN,anent);
  dc.Check(ach,anent);
  OwnCheckCase (CN,anent,shares,ach);
}


    Standard_Boolean  IGESData_GeneralModule::CanCopy
  (const Standard_Integer CN, const Handle(Standard_Transient)& ent) const
      {  return Standard_True;  }

    void  IGESData_GeneralModule::CopyCase
  (const Standard_Integer CN, const Handle(Standard_Transient)& entfrom,
   const Handle(Standard_Transient)& entto, Interface_CopyTool& TC) const 
{
  DeclareAndCast(IGESData_IGESEntity,ento,entto);
  DeclareAndCast(IGESData_IGESEntity,enfr,entfrom);
////  ento->Clear();

// ...                Reprendre entete                ...
//?  ento->InitTypeAndForm (enfr->TypeNumber(), enfr->FormNumber());ShallowCopy
  
  if (enfr->DefLineFont() == IGESData_DefReference) ento->InitLineFont
    (GetCasted(IGESData_LineFontEntity,    TC.Transferred(enfr->LineFont())));
  else ento->InitLineFont (enfr->LineFont() , enfr->RankLineFont());

  if (enfr->DefLevel() == IGESData_DefSeveral) ento->InitLevel
    (GetCasted(IGESData_LevelListEntity,TC.Transferred(enfr->LevelList())),-1);
  else ento->InitLevel (enfr->LevelList() , enfr->Level());

  if (enfr->DefView() != IGESData_DefNone) ento->InitView
    (GetCasted(IGESData_ViewKindEntity,    TC.Transferred(enfr->View())));

  if (enfr->HasTransf()) ento->InitTransf
    (GetCasted(IGESData_TransfEntity,      TC.Transferred(enfr->Transf())));

  ento->InitStatus (enfr->BlankStatus() ,
		    enfr->SubordinateStatus() ,
		    enfr->UseFlag() ,
		    enfr->HierarchyStatus() );

  if (enfr->DefColor() == IGESData_DefReference) ento->InitColor
    (GetCasted(IGESData_ColorEntity,TC.Transferred(enfr->Color())));
  else ento->InitColor (enfr->Color() , enfr->RankColor());

  if (enfr->HasShortLabel()) ento->SetLabel
    (new TCollection_HAsciiString(enfr->ShortLabel()),
     enfr->SubScriptNumber());
  else ento->SetLabel (enfr->ShortLabel() , enfr->SubScriptNumber());

//  Directory Part : Miscellaneous
  Handle(IGESData_IGESEntity) Structure;
  if (enfr->HasStructure()) Structure =
    GetCasted(IGESData_IGESEntity,         TC.Transferred(enfr->Structure()));
  if (enfr->HasLabelDisplay()) ento->InitMisc
    (Structure,
     GetCasted(IGESData_LabelDisplayEntity,TC.Transferred(enfr->LabelDisplay())),
     enfr->LineWeightNumber());
  else ento->InitMisc
    (Structure , enfr->LabelDisplay() , enfr->LineWeightNumber());

//  LineWeightValue, Res1, Res2 : through action of ShallowCopy ?

  OwnCopyCase (CN,enfr,ento,TC);

//  ..  Properties
  if (enfr->NbProperties() != 0) {
    for (Interface_EntityIterator iter = enfr->Properties();
	 iter.More(); iter.Next()) {
      ento->AddProperty
	(GetCasted(IGESData_IGESEntity,TC.Transferred(iter.Value())));
    }
  }
}

    void  IGESData_GeneralModule::RenewImpliedCase
  (const Standard_Integer CN, const Handle(Standard_Transient)& entfrom,
   const Handle(Standard_Transient)& entto, const Interface_CopyTool& TC) const
{
  DeclareAndCast(IGESData_IGESEntity,ento,entto);
  DeclareAndCast(IGESData_IGESEntity,enfr,entfrom);

  OwnRenewCase (CN,enfr,ento,TC);

//  .. Associativities
  if (enfr->NbAssociativities() != 0) {
    for (Interface_EntityIterator iter = enfr->Associativities();
	 iter.More(); iter.Next()) {
      Handle(Standard_Transient) anent = iter.Value();
      Handle(Standard_Transient) newent;
      if (TC.Search(anent,newent)) ento->AddAssociativity
	(GetCasted(IGESData_IGESEntity,newent));
    }
  }
}

    void  IGESData_GeneralModule::OwnRenewCase
  (const Standard_Integer , const Handle(IGESData_IGESEntity)& ,
   const Handle(IGESData_IGESEntity)& , const Interface_CopyTool& ) const
     {  }

    void  IGESData_GeneralModule::WhenDeleteCase
  (const Standard_Integer CN, const Handle(Standard_Transient)& ent,
   const Standard_Boolean ) const    // dispatched : ignored
{
  DeclareAndCast(IGESData_IGESEntity,anent,ent);
  if (anent.IsNull()) return;
  anent->Clear();
  OwnDeleteCase (CN,anent);
}

    void  IGESData_GeneralModule::OwnDeleteCase
  (const Standard_Integer , const Handle(IGESData_IGESEntity)& ) const
      {  }  // par defaut, rien  (redefinissable)


    Handle(TCollection_HAsciiString)  IGESData_GeneralModule::Name
  (const Standard_Integer , const Handle(Standard_Transient)& ent,
   const Interface_ShareTool& ) const
{
  Handle(TCollection_HAsciiString) name;
  DeclareAndCast(IGESData_IGESEntity,anent,ent);
  if (anent.IsNull()) return name;
  name = anent->NameValue ();
  return name;
}