0027232: Configuration - fix mblen missing building issue on Android
[occt.git] / src / IGESBasic / IGESBasic_Group.cxx
CommitLineData
b311480e 1// Created by: CKY / Contract Toubro-Larsen
2// Copyright (c) 1993-1999 Matra Datavision
973c2be1 3// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
7fd59977 6//
d5f74e42 7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
7fd59977 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
16//--------------------------------------------------------------------
7fd59977 17//--------------------------------------------------------------------
7fd59977 18// ptv and rln 14.09.2000 BUC60743
19
42cf5bc1 20#include <IGESBasic_Group.hxx>
21#include <IGESData_IGESEntity.hxx>
7fd59977 22#include <Standard_DimensionMismatch.hxx>
23#include <Standard_OutOfRange.hxx>
42cf5bc1 24#include <Standard_Transient.hxx>
25#include <Standard_Type.hxx>
7fd59977 26
92efcf78 27IMPLEMENT_STANDARD_RTTIEXT(IGESBasic_Group,IGESData_IGESEntity)
28
b311480e 29IGESBasic_Group::IGESBasic_Group () { InitTypeAndForm(402,1); }
7fd59977 30
31 IGESBasic_Group::IGESBasic_Group
32 (const Standard_Integer nb)
33{
34 InitTypeAndForm(402,1);
35 if (nb <= 0) return;
36 theEntities = new IGESData_HArray1OfIGESEntity (1,nb);
37}
38
39
40 void IGESBasic_Group::Init
41 (const Handle(IGESData_HArray1OfIGESEntity)& allEntities)
42{
43 // ptv and rln September 14, 2000 BUC60743
44 // Protection against empty groups
45 if (!allEntities.IsNull() && (allEntities->Lower() != 1))
46 Standard_DimensionMismatch::Raise("IGESBasic_Group : Init");
47 theEntities = allEntities;
48 if (FormNumber() == 0) InitTypeAndForm(402,1);
49}
50
51 void IGESBasic_Group::SetOrdered (const Standard_Boolean mode)
52{
53 Standard_Integer fn = FormNumber();
54 if (mode) {
55 if (fn == 0 || fn == 1) InitTypeAndForm (402,14);
56 else if (fn == 7) InitTypeAndForm (402,15);
57 } else {
58 if (fn == 14) InitTypeAndForm (402,1);
59 else if (fn == 15) InitTypeAndForm (402,7);
60 }
61}
62
63 void IGESBasic_Group::SetWithoutBackP (const Standard_Boolean mode)
64{
65 Standard_Integer fn = FormNumber();
66 if (mode) {
67 if (fn == 0 || fn == 1) InitTypeAndForm (402,7);
68 else if (fn == 14) InitTypeAndForm (402,15);
69 } else {
70 if (fn == 7) InitTypeAndForm (402,1);
71 else if (fn == 15) InitTypeAndForm (402,14);
72 }
73}
74
75 Standard_Boolean IGESBasic_Group::IsOrdered () const
76{
77 Standard_Integer fn = FormNumber();
78 return (fn > 7);
79}
80
81 Standard_Boolean IGESBasic_Group::IsWithoutBackP () const
82{
83 Standard_Integer fn = FormNumber();
84 return (fn == 7 || fn == 15);
85}
86
87 void IGESBasic_Group::SetUser
88 (const Standard_Integer type, const Standard_Integer form)
89{
90 if (type <= 5000) Standard_OutOfRange::Raise("IGESBasic_Group::SetUser");
91 InitTypeAndForm (type,form);
92}
93
94
95 void IGESBasic_Group::SetNb (const Standard_Integer nb)
96{
97 Standard_Integer i, oldnb = NbEntities();
98 if (nb == oldnb || nb <= 0) return;
99
100 Handle(IGESData_HArray1OfIGESEntity) newents = new IGESData_HArray1OfIGESEntity(1,nb);
101 if (oldnb > nb) oldnb = nb;
102 for (i = 1; i <= oldnb; i ++) newents->SetValue (i,theEntities->Value(i));
103 theEntities = newents;
104}
105
106 Standard_Integer IGESBasic_Group::NbEntities () const
107 { return(theEntities.IsNull() ? 0 : theEntities->Length()); }
108
109 Handle(IGESData_IGESEntity) IGESBasic_Group::Entity
110 (const Standard_Integer Index) const
111 { return theEntities->Value(Index); }
112
5b111128 113Handle(Standard_Transient) IGESBasic_Group::Value (const Standard_Integer Index) const
114{
115 return Handle(Standard_Transient) (theEntities->Value(Index));
116}
7fd59977 117
118 void IGESBasic_Group::SetValue
119 (const Standard_Integer Index, const Handle(IGESData_IGESEntity)& ent)
120 { theEntities->SetValue (Index,ent); }