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
|
//--------------------------------------------------------------------
//
// File Name : IGESBasic_Group.cxx
// Date :
// Author : CKY / Contract Toubro-Larsen
// Copyright : MATRA-DATAVISION 1993
//
//--------------------------------------------------------------------
// ptv and rln 14.09.2000 BUC60743
#include <IGESBasic_Group.ixx>
#include <Standard_DimensionMismatch.hxx>
#include <Standard_OutOfRange.hxx>
IGESBasic_Group::IGESBasic_Group () { InitTypeAndForm(402,1); }
IGESBasic_Group::IGESBasic_Group
(const Standard_Integer nb)
{
InitTypeAndForm(402,1);
if (nb <= 0) return;
theEntities = new IGESData_HArray1OfIGESEntity (1,nb);
}
void IGESBasic_Group::Init
(const Handle(IGESData_HArray1OfIGESEntity)& allEntities)
{
// ptv and rln September 14, 2000 BUC60743
// Protection against empty groups
if (!allEntities.IsNull() && (allEntities->Lower() != 1))
Standard_DimensionMismatch::Raise("IGESBasic_Group : Init");
theEntities = allEntities;
if (FormNumber() == 0) InitTypeAndForm(402,1);
}
void IGESBasic_Group::SetOrdered (const Standard_Boolean mode)
{
Standard_Integer fn = FormNumber();
if (mode) {
if (fn == 0 || fn == 1) InitTypeAndForm (402,14);
else if (fn == 7) InitTypeAndForm (402,15);
} else {
if (fn == 14) InitTypeAndForm (402,1);
else if (fn == 15) InitTypeAndForm (402,7);
}
}
void IGESBasic_Group::SetWithoutBackP (const Standard_Boolean mode)
{
Standard_Integer fn = FormNumber();
if (mode) {
if (fn == 0 || fn == 1) InitTypeAndForm (402,7);
else if (fn == 14) InitTypeAndForm (402,15);
} else {
if (fn == 7) InitTypeAndForm (402,1);
else if (fn == 15) InitTypeAndForm (402,14);
}
}
Standard_Boolean IGESBasic_Group::IsOrdered () const
{
Standard_Integer fn = FormNumber();
return (fn > 7);
}
Standard_Boolean IGESBasic_Group::IsWithoutBackP () const
{
Standard_Integer fn = FormNumber();
return (fn == 7 || fn == 15);
}
void IGESBasic_Group::SetUser
(const Standard_Integer type, const Standard_Integer form)
{
if (type <= 5000) Standard_OutOfRange::Raise("IGESBasic_Group::SetUser");
InitTypeAndForm (type,form);
}
void IGESBasic_Group::SetNb (const Standard_Integer nb)
{
Standard_Integer i, oldnb = NbEntities();
if (nb == oldnb || nb <= 0) return;
Handle(IGESData_HArray1OfIGESEntity) newents = new IGESData_HArray1OfIGESEntity(1,nb);
if (oldnb > nb) oldnb = nb;
for (i = 1; i <= oldnb; i ++) newents->SetValue (i,theEntities->Value(i));
theEntities = newents;
}
Standard_Integer IGESBasic_Group::NbEntities () const
{ return(theEntities.IsNull() ? 0 : theEntities->Length()); }
Handle(IGESData_IGESEntity) IGESBasic_Group::Entity
(const Standard_Integer Index) const
{ return theEntities->Value(Index); }
Handle(Standard_Transient) IGESBasic_Group::Value
(const Standard_Integer Index) const
{ return theEntities->Value(Index); }
void IGESBasic_Group::SetValue
(const Standard_Integer Index, const Handle(IGESData_IGESEntity)& ent)
{ theEntities->SetValue (Index,ent); }
|