1 //--------------------------------------------------------------------
3 // File Name : IGESBasic_Group.cxx
5 // Author : CKY / Contract Toubro-Larsen
6 // Copyright : MATRA-DATAVISION 1993
8 //--------------------------------------------------------------------
10 // ptv and rln 14.09.2000 BUC60743
12 #include <IGESBasic_Group.ixx>
13 #include <Standard_DimensionMismatch.hxx>
14 #include <Standard_OutOfRange.hxx>
17 IGESBasic_Group::IGESBasic_Group () { InitTypeAndForm(402,1); }
19 IGESBasic_Group::IGESBasic_Group
20 (const Standard_Integer nb)
22 InitTypeAndForm(402,1);
24 theEntities = new IGESData_HArray1OfIGESEntity (1,nb);
28 void IGESBasic_Group::Init
29 (const Handle(IGESData_HArray1OfIGESEntity)& allEntities)
31 // ptv and rln September 14, 2000 BUC60743
32 // Protection against empty groups
33 if (!allEntities.IsNull() && (allEntities->Lower() != 1))
34 Standard_DimensionMismatch::Raise("IGESBasic_Group : Init");
35 theEntities = allEntities;
36 if (FormNumber() == 0) InitTypeAndForm(402,1);
39 void IGESBasic_Group::SetOrdered (const Standard_Boolean mode)
41 Standard_Integer fn = FormNumber();
43 if (fn == 0 || fn == 1) InitTypeAndForm (402,14);
44 else if (fn == 7) InitTypeAndForm (402,15);
46 if (fn == 14) InitTypeAndForm (402,1);
47 else if (fn == 15) InitTypeAndForm (402,7);
51 void IGESBasic_Group::SetWithoutBackP (const Standard_Boolean mode)
53 Standard_Integer fn = FormNumber();
55 if (fn == 0 || fn == 1) InitTypeAndForm (402,7);
56 else if (fn == 14) InitTypeAndForm (402,15);
58 if (fn == 7) InitTypeAndForm (402,1);
59 else if (fn == 15) InitTypeAndForm (402,14);
63 Standard_Boolean IGESBasic_Group::IsOrdered () const
65 Standard_Integer fn = FormNumber();
69 Standard_Boolean IGESBasic_Group::IsWithoutBackP () const
71 Standard_Integer fn = FormNumber();
72 return (fn == 7 || fn == 15);
75 void IGESBasic_Group::SetUser
76 (const Standard_Integer type, const Standard_Integer form)
78 if (type <= 5000) Standard_OutOfRange::Raise("IGESBasic_Group::SetUser");
79 InitTypeAndForm (type,form);
83 void IGESBasic_Group::SetNb (const Standard_Integer nb)
85 Standard_Integer i, oldnb = NbEntities();
86 if (nb == oldnb || nb <= 0) return;
88 Handle(IGESData_HArray1OfIGESEntity) newents = new IGESData_HArray1OfIGESEntity(1,nb);
89 if (oldnb > nb) oldnb = nb;
90 for (i = 1; i <= oldnb; i ++) newents->SetValue (i,theEntities->Value(i));
91 theEntities = newents;
94 Standard_Integer IGESBasic_Group::NbEntities () const
95 { return(theEntities.IsNull() ? 0 : theEntities->Length()); }
97 Handle(IGESData_IGESEntity) IGESBasic_Group::Entity
98 (const Standard_Integer Index) const
99 { return theEntities->Value(Index); }
101 Handle(Standard_Transient) IGESBasic_Group::Value
102 (const Standard_Integer Index) const
103 { return theEntities->Value(Index); }
105 void IGESBasic_Group::SetValue
106 (const Standard_Integer Index, const Handle(IGESData_IGESEntity)& ent)
107 { theEntities->SetValue (Index,ent); }